|
-
May 24th, 1999, 01:48 AM
#1
Attach BMP to control button
I am using vc++ 6.0.
I would like to know how to attach a BMP file to my control button instead of adding text.
ty
-
May 24th, 1999, 01:52 AM
#2
Re: Attach BMP to control button
You need a CBitmapButton.
-
May 24th, 1999, 02:03 AM
#3
Re: Attach BMP to control button
You set the button's property to Ownerdraw,
then you can draw the bitmap in the
OnDraw(or OnButtonDraw.., I forget) function.
-
May 26th, 1999, 09:34 AM
#4
Re: Attach BMP to control button
You can load in the BMP file using ::LoadImage(). This lets you load either a bitmap resource or a .bmp file and get a handle to a bitmap. Pass this handle to the SetBitmap() of the CButton. You also need to set the BS_BITMAP style for the button which you can do in the resource editor. You can also use a CBitmapButton or an owner drawn button but they are a bit more complicated. The disadvantage of using a SetBitmap() is that you only have one bitmap for the button whereas a CBitmapButton lets you specify different bitmaps depending on the state of the button. So for example if you use SetBitmap() for a disabled button it tends to look rather ugly (I have a solution for that but its complicated).
If you have any questions or need a code sample let me know.
Josh
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
|