• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 175
  • Last Modified:

How can I put image into control bar...

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
wanlop
Asked:
wanlop
  • 3
  • 2
  • 2
1 Solution
 
migelCommented:
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
 
wanlopAuthor Commented:
yes I would like to insert  background image into Dialogbar.
please suggest me.
thank
0
 
fl0ydCommented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
wanlopAuthor Commented:
do you have some sample?
0
 
migelCommented:
Hi!
You can use same tecnique as for CDialog did you try this?
0
 
fl0ydCommented:
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
 
wanlopAuthor Commented:
Thanks it's work
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now