|
-
April 15th, 1999, 05:15 AM
#1
Setting button bitmaps
How do you set a bitmap to be the surface of the button using the CButton object? I do not want to use the CBitmapButton class.
I have tried something like this:
CBitmap bmp;
bmp.LoadBitmap(ID_BITMAP1)
button.SetBitmap((HBITMAP)bmp);
but I keep getting a run time error (no helpful info in the error).
I have tried setting the button styles to BS_OWNERDRAW with still no effect.
Would appreciate any help
-
April 15th, 1999, 05:48 AM
#2
Re: Setting button bitmaps
It might be that you have to make the bitmap available to the button after the scope where you set the bitmap runs out. That is, try making bmp a member of your class so it isn't destroyed when your function returns. Otherwise, the bitmap is destroyed and when the button tries to access it(when repainting itself), you get a run time error.
/Michael Grundberg
M.Sc. Computer Science
Visionova IT-System, Sweden
[email protected]
-
April 16th, 1999, 12:11 PM
#3
Re: Setting button bitmaps
Why not use the CBitmapButton class ? It's really very simple.
It handles the subclassing of the button so that the new drawing
function is called. It also manages the drawing of the four states
of a button. The sample CTRLTEST has a good illustration of
this but it doesn't show all four states of the button (I think).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|