Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC
i want to show a bitmap on button , searched google but not getting how to implement it sp any bidy can give me suggestion about this
Posted 18-Jul-12 2:10am
Comments
Wes Aday at 18-Jul-12 9:25am
   
"searched google but not getting how to implement it"... you must not be trying very hard. What exactly are you having trouble with? Have you actually tried anything at all?
Joan Murt at 19-Jul-12 3:11am
   
My vote of 1 is due to the lack of explanation, the lack of trying and the lack of interest even with a good answer like the one from Chris Losinger.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

look here: http://www.codeproject.com/KB/buttons/#Owner-draw+buttons[^]
 
there are dozens of bitmap button articles.
  Permalink  
Comments
yasardiwan at 18-Jul-12 8:44am
   
didnt understand my friend
Wes Aday at 18-Jul-12 9:24am
   
What did you not understand?
Joan Murt at 19-Jul-12 3:10am
   
Be water my friend... :D
 
I was about to post the same link, there are plenty of articles there which are related to what you need, with samples, projects... take a look at it and you will see it.
Joan Murt at 19-Jul-12 3:11am
   
The best link available to give the best answer possible. my 5.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Owner draw will enable you to handle only drawing of the button, it will not effect click, double click etc event of the button.
 
To make button owner draw you have to specify BS_OWNERDRAW style when you create the button.
 
by specifying BS_OWNERDRAW style,you enable The owner window receives a WM_DRAWITEM message when a visual aspect of the button has changed.
 
You can handle this message by overriding(for that you have to create a class which is derived from CButton class)
DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
lpDrawItemStruct variable have information which state the button gaining. e.g
if (lpDrawItemStruct->itemState & ODS_SELECTED){ // draw selected state of button as your wish.}
similarly different style for different control. for that study this link[^]
 
similarly you can draw other states of the button.
here http://msdn.microsoft.com/en-us/library/y0k9f0a4.aspx[^] they give a example.
I hope this is helpful.
 
Sorry for my english.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Here is another article that can help
http://www.functionx.com/visualc/controls/bmpbtn.htm[^]
 
All the Best!!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 20 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100