Change background color of a Dialog box? 
Author Message
 Change background color of a Dialog box?

How can I do that? Thanks!


Tue, 04 Mar 2003 03:00:00 GMT  
 Change background color of a Dialog box?
LukeV:

Handle WM_CTLCOLOR message and change the brush. Make sure brush is a
member variable, or it will go out of scope.

HTH,

Dvaid Wilkinson

===============

Quote:

> How can I do that? Thanks!



Tue, 04 Mar 2003 03:00:00 GMT  
 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Tue, 04 Mar 2003 03:00:00 GMT  
 Change background color of a Dialog box?


Quote:
> How can I do that? Thanks!

Process the WM_ERASEBKGND message for the dialog, and paint it whatever
colour you wish in response.

Regards,

--
Chris
-----------------------------------------------------------------------

Visit our web site at http://www.skymap.com
Astronomy software written by astronomers, for astronomers



Wed, 05 Mar 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Change background color of a Dialog box?

2. Change background color of dialog box title

3. Change Dialog Box Background Color

4. I would like to change the background color of a dialog box

5. Changing the Background Color of a Dialog to match the background of a Bitmap

6. Change the background color of a dialog box and change text color of Edit Box, Static Text, Rich Edit

7. Changing background color of a group box

8. changing background color of a message box?

9. How to change the background color of an edit box

10. Changing the background color of a check box...

11. change background color of drop down list box

12. background color for dialog box

 

 
Powered by phpBB® Forum Software