How to change the background color of the window

zhaozj2021-02-17  72

How to change the background color of the window

Windows sends a WM_ERASEBKGND message to the window to inform the window erase background, you can use

ClassWizard Reserves the default handler of the message to erase the background (actually painting) and return True to

Prevent Windows Erase Window.

Bool CBoxView :: OneRaseBkGnd (CDC * PDC)

{CBRUSH Brush (RGB (128, 0, 128));

// Select the brush into the device context.

CBRUSH * POLDBRUSH = PDC-> SelectObject (& brush) ;.

CRECT RCCLIP

PDC-> GetClipbox (& RCLIP); // Paint The Area.

PDC-> Patblt (rcclip.left, rcclip.top, rcclip.width (), rcclip.Height (), PATCopy;

PDC-> SELECTOBJECT (POLDBRUSH);

Return True;}

转载请注明原文地址:https://www.9cbs.com/read-31494.html

New Post(0)