INFO: Owner-Draw Buttons with Bitmaps on Non-Standard Displays
ID: Q67715
|
The information in this article applies to:
-
Microsoft Win32 Software Development Kit (SDK)
-
Microsoft Windows Software Development Kit (SDK) versions 3.0, 3.1
-
Microsoft Windows 2000
SUMMARY
If an application contains an owner-draw button that paints itself with a
bitmap, the application's resources must contain a set of bitmaps
appropriate to each display type on which the application might run.
If the application's resources do not contain bitmaps suitable for the
display on which the application is running, the application can use the
default 3-D button appearance by changing the button style to BS_PUSHBUTTON
from BS_OWNERDRAW.
Under Windows 95, there is a new style BS_BITMAP which applications might
find easier to use.
Changing the style of a button is possible in Windows version 3.0; however,
this technique is not guaranteed to be supported in future releases of
Windows.
MORE INFORMATION
An owner-draw button can use bitmaps to paint itself. When an application
contains this type of owner-draw button, it must also contain a set of
bitmaps appropriate for each display type on which the application might
run. Each set of bitmaps has a normal "up" bitmap and a depressed "down"
bitmap to implement the 3-D effects. The most common standard Windows
display types are: CGA, EGA, VGA, 8514/a, and Hercules Monochrome. The
dimensions and aspect ratio of the display affect the appearance of the
bitmap. For example, a monochrome bitmap designed for VGA will display
correctly on an 8514/a and any other display with a 1:1 aspect ratio.
If an application determines that it does not contain an appropriate set of
bitmaps for the current display type, then it should change the button
style from BS_OWNERDRAW to BS_PUSHBUTTON. After the style has been changed
and the button has been redrawn, the button will appear as a normal 3-D
push button.
The following code fragment demonstrates how to change the style of a
push button from owner-draw to normal:
...
/*
* hWndButton is assumed to be the handle to the button.
* Note that lParam has a nonzero value, which forces the button
* to be redrawn. This assures that the normal button appearance
* will show after this message is sent.
*/
SendMessage(hWndButton, BM_SETSTYLE, BS_PUSHBUTTON, 1L);
...
Additional query words:
Keywords : kbButton kbCtrl kbNTOS kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS
Version : WINDOWS:3.0,3.1
Platform : WINDOWS
Issue type : kbinfo