Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
2.00/5 (4 votes)
See more:
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
Comments
[no name] 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 M 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.

look here: http://www.codeproject.com/KB/buttons/#Owner-draw+buttons[^]

there are dozens of bitmap button articles.
 
Share this answer
 
Comments
yasardiwan 18-Jul-12 8:44am    
didnt understand my friend
[no name] 18-Jul-12 9:24am    
What did you not understand?
Joan M 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 M 19-Jul-12 3:11am    
The best link available to give the best answer possible. my 5.
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.
 
Share this answer
 
Here is another article that can help
http://www.functionx.com/visualc/controls/bmpbtn.htm[^]

All the Best!!
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900