...

View Full Version : Vc++



Aymen++
11-30-2002, 10:08 AM
How can I change the color of the background of a dialog in VC++?
Note: I'm using windows XP & ME.

maes
12-03-2002, 06:23 PM
You have to capture some WM_CTLCOLOR* messages:


case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
SetBkColor((HDC)wParam,RGB(255,0,0));
return (BOOL)CreateSolidBrush(RGB(0,0,255));

The SetBkColor sets the background (here RED) of your static text, if you don't have any, you don't have to use it.
the return value is a handel to a brush (casted to BOOL) for a brush that we created. this will give a nice blue background

for a bit more info on WM_CTLCOLORDLG (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxmessages/wm_ctlcolordlg.asp) from msdn


If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the dialog box.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum