CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2001
    Location
    Singapore
    Posts
    200

    Changing the colour of dialog boxes

    I need to change the colour of dialog boxes from grey to green.

    Using ON-WM_CTLCOLOR i have managed to do that. However not everything inside the dialog box have been changed. The main problem is the Group Box and static text. The words entered for the Caption will cause the background colour behind the caption to change to white or grey, thus making the the dialog box very unsightly. The background colour behind the static text also has the same problem

    The tabs for property pages inside the dialog also remain at grey colour despite the dialog box being changed to green colour.

    How can i solve this problem???

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725
    add CTLCOLOR_STATIC to process the same
    way CTLCOLOR_DIALOG does ...


    Code:
    HBRUSH CD2Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
       HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
    
       if(nCtlColor == CTLCOLOR_DLG || nCtlColor == CTLCOLOR_STATIC)	
       {	
                 // whatever you do
                 pDC->SetBkColor(m_dlgBackColor);
                 hbr = (HBRUSH)m_brush.GetSafeHandle();
       }
    //
       return hbr;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured