|
-
July 29th, 2004, 05:37 AM
#1
How to change Dialog Background Color
I created a dialog using MSVC++ resource editor (ID: IDC_DRAWING_AREA).
Then I have this code:
//Get a handle to IDC_DRAWING_AREA window
hDwgArea = CreateDialog(hInstance,
MAKEINTRESOURCE(IDC_DRAWING_AREA),
hWindows[3], NULL);
I want to change the background of IDC_DRAWING_AREA from its default color to WHITE. Is it doable?
-
July 29th, 2004, 07:06 AM
#2
See MSDN related to WM_CTLCOLORDLG message
-
July 29th, 2004, 07:11 AM
#3
Here's an example:
Code:
BOOL CALLBACK DialogProc(HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
static HBRUSH hBrush = NULL;
switch (uMessage)
{
case WM_INITDIALOG:
hBrush = CreateSolidBrush(RGB(255, 255, 255));
return FALSE;
case WM_CTLCOLORDLG:
if (hBrush)
return (INT_PTR) hBrush;
else
return FALSE;
case WM_CLOSE:
if (hBrush)
DeleteObject(hBrush);
EndDialog(hwnd, 0);
return FALSE;
default:
return FALSE;
}
}
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
-
July 29th, 2004, 06:52 PM
#4
Thank you very much Mr. Bond. I really appreciate you here being helpful to many codeguru members.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|