INF: Owner-Draw Buttons with Bitmaps on Non-Standard Displays

ID Number: Q67715

3.00

WINDOWS

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.

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.

For more information on owner-draw controls, please query on the

following words in the Microsoft Knowledge Base:

prod(winsdk) and owner-draw

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(hWnd, BM_SETSTYLE, BS_PUSHBUTTON, 1L);

...

Additional reference words: 3.00