Solved

How can I put image into control bar...

Posted on 2002-07-01
7
163 Views
Last Modified: 2013-11-20
Hi all,
   I have some question  about control bar, How can I put an images into control bar like a backgroud image. I saw
only turtorial  for image backgroud dialog.
pls advise me
thank you
0
Comment
Question by:wanlop
  • 3
  • 2
  • 2
7 Comments
 
LVL 12

Expert Comment

by:migel
ID: 7121508
Hi!
CControlBar is base class so it doesn`t draw anything - it just belongs on derived classe for painting.
Do you want insert bacground image into the toolbar or Dialogbar?
0
 

Author Comment

by:wanlop
ID: 7123497
yes I would like to insert  background image into Dialogbar.
please suggest me.
thank
0
 
LVL 8

Expert Comment

by:fl0yd
ID: 7123567
You need to derive a class from CControlBar, lets call it CMyControlBar and override its CMyControlBar::OnEraseBkgnd( CDC* pDC )-function. Perform your desired drawing in this function and return TRUE.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:wanlop
ID: 7123628
do you have some sample?
0
 
LVL 12

Expert Comment

by:migel
ID: 7123907
Hi!
You can use same tecnique as for CDialog did you try this?
0
 
LVL 8

Accepted Solution

by:
fl0yd earned 100 total points
ID: 7123918
class CMyControlBar : public CControlBar {
public:
    afx_msg BOOL OnEraseBkgnd( CDC* pDC );
};

In your existing code replace CControlBar with this CMyControlBar-class after you implemented the drawing in OnEraseBkgnd. It's probably easier to use the class wizard to derive your class - but it can also be done manually. To get to your goal more easily break down your problem into subproblems: The first one is to actually be able to paint the background yourself. Don't worry about the image now; just call some simple drawing functions to see if it's working, some MoveTo's/LineTo's or FillSolidRect's are all you need to do. When that's working go on to the next task. Be warned though, displaying bitmaps holds more surprises than anyone would like to remember.
0
 

Author Comment

by:wanlop
ID: 7124171
Thanks it's work
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 125
iSeries FTP Exit Program 8 135
lucky13 challenge 11 140
x-bar in Google Sheets 2 52
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question