ctyuang
May 24th, 1999, 01:48 AM
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
I would like to know how to attach a BMP file to my control button instead of adding text.
ty
|
Click to See Complete Forum and Search --> : Attach BMP to control button ctyuang May 24th, 1999, 01:48 AM 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 Jason Teagle May 24th, 1999, 01:52 AM You need a CBitmapButton. Tianzh May 24th, 1999, 02:03 AM You set the button's property to Ownerdraw, then you can draw the bitmap in the OnDraw(or OnButtonDraw.., I forget) function. Josh Handley May 26th, 1999, 09:34 AM 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 codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |