Click to See Complete Forum and Search --> : image in API button?


Thomas
April 21st, 1999, 04:52 PM
Can somebody tell me how to attach a bitmap to a button using Windows API only? Thanks in advance!

Thomas

April 22nd, 1999, 01:31 AM
Hello,

If you use MFC it's very easy

1 ) for eatch button create 3 bitmap resource

call

Button_D => Img button Down
Button_F => Img button Focus
Button_U => Img button Up

2 ) create your button ( don't use classwizard )
- Create the button in your Dlg and call it IDC_PUSH_BUTTON ( for example ), in the area where you put text, put Button_ don't forgat to put the _, and Activate the flag Ownerdraw.
- CBitmapButton c_My_Button; ( in header file .h )
- On the OnInitDialog or the Init fonction of your SDI or MDI ( .cpp ):
c_My_Button; = new CBitmapButton;
VERIFY ( c_My_Button; -> AutoLoad ("Put here the name of the button resource ex : IDC_PUSH_BUTTON ), this ));

A+,

Arnaud Chainard at :
Terrasse.Gaetan@wanadoo.fr