
Change background color of a Dialog box?
Quote:
>How can I do that? Thanks!
SetSysColors for COLOR_3DFACE. That will change them all. Otherwise if
you want to change just one dialog, you'll have handle WM_CTLCOLOR and
return your own brush for CTLCOLOR_DLG, e.g.
const COLORREF crefDarkGray = (RGB(128,128,128));
BOOL CTestbed2Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
...
m_DGBrushStruct.lbStyle = BS_SOLID;
m_DGBrushStruct.lbColor = crefDarkGray;
m_DGBrushStruct.lbHatch = 0;
m_DGBrush = ::CreateBrushIndirect (&m_DGBrushStruct);
....
HBRUSH CTestbed2Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch (nCtlColor)
{
case CTLCOLOR_DLG:
return m_DGBrush;
break;
...
--
Bob Moore [Microsoft MVP - WinSDK]
http://www.mooremvp.freeserve.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to an unreasonable amount of queries, I no
longer answer unsolicited email questions. Sorry,
no exceptions.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~