Controls and Colors

As you can see in Figure 9-2 the display of many of the buttons doesn’t look quite right. The push buttons are fine, but the others are drawn with a rectangular gray background that simply shouldn’t be there. This is because the buttons are designed to be displayed in dialog boxes, and in Windows 98 dialog boxes have a gray surface. Our window has a white surface because that’s how we defined it in the WNDCLASS structure:

wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;

We’ve been doing this because we often display text to the client area, and GDI uses the text color and background color defined in the default device context. These are always black and white. To make these buttons look a little better, we must ...

Get Programming Windows®, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.