How to change a CBitmapButton Image on Mouse Over in VC++/MFC

hi alll
      i have  an application in which i am using a CBitmapButton i want that when move mouse over button then the button should change image.
    for that i am doing the following things

1- i have created a new class Ccustombutton derived from CBitmapButton. in this i am handling mouse move handler.

2- in mouse move handler i am using LoadBitmaps(IDC_BMP1,IDC_BMP2,IDC_BMP3,IDC_BMP4)


But i am not able to do this


please tell me how to do this
 
RuhelaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZoppoCommented:
Hi Ruhela,

there's no need to load the bittmaps in a mouse move handler - just load them after you created the button, i.e. if the button is used in a dialog in OnInitDialog.

Further you have to ensure that the BS_OWNERDRAW style for the button is set - this can be done in resource editor.

ZOPPO
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pgnatyukCommented:
And do not forget to draw the button.
HOWTO: How to Use CBitmapButton to Resize a Bitmap to Fit a Button
http://support.microsoft.com/kb/134421


0
ZoppoCommented:
> And do not forget to draw the button.
this is only needed if the bitmaps need to be stretched to fit - if they are drawn correctly without stretching the default implementation is ok ...
0
AndyAinscowFreelance programmer / ConsultantCommented:
I think the MFC feature pack (requires VS2008) has a new MFC button - this supports a 'hot' image that is displayed when the mouse is over the button.  That sounds exactly like what you are asking about.
0
RuhelaAuthor Commented:
solved
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.