Topic : Buttons
Author : Unknown
Page : << Previous 6  
Go to page :


use this class, we need to prepare 1 to 4 bitmap resources indicating button's different states, then use class CBitmapButton to declare variables, and call either CBitmapButton::AutoLoad(...) or CBitmapButton::LoadBitmaps(...) to associate the bitmap resources with the buttons.

2) To use function CBitmapButton::AutoLoad(...), the bitmap resources must have string IDs, and must be created by suffixing 'U', 'D', 'F' or 'X' to the button's caption text.

3) Buttons, check boxes and radio buttons implemented by class CButton can display user-provided bitmaps by calling function CButton::LoadBitmap(...). With this method, the button could be associated with only one image at any time. Also, its focused state will be indicated by drawing a dash-bordered rectangle over button's face.

4) We can call function CBitmapButton::LoadBitmaps(...) at any time to change the associated bitmaps. This provides us a way of implementing check box and radio button using push button.

5) Irregular shape button can be implemented by drawing images with transparency. We can prepare a normal image and a black-and-white mask image. When drawing the button, only the unmasked region of the normal image should be output to the target device.

6) A button can handle mouse-related messages. If we want to know the mouse position when a button is being pressed, we can trap WM_LBUTTONUP message.

7) We can implement mouse sensitive button by handling WM_MOUSEMOVE message and setting window capture.

Page : << Previous 6