0

I need to create a custom dialog in mfc which has a different appearance than the usual MFC dialogs.For example the color should be blue, the style etc. Is it possible? How can I do this?

CodeRider
  • 1,750
  • 6
  • 18
  • 34

1 Answers1

1

I googled the background color:
See here

//CMyDlg.h
//Add a CBrush object

class CMyDlg : public CDialog
{
// Construction
    public:
    CTest2Dlg(CWnd* pParent = NULL);    // standard constructor
    CBrush  m_brush;
// Dialog Data


//initialize the brush with the desired color in the OnInitDialog() methodl  


BOOL CMyDlg::OnInitDialog()
{   
    m_brush.CreateSolidBrush(RGB(255,0,0));
    CDialog::OnInitDialog();

}

//Return the brush like this:

HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
//  HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

// TODO: Return a different brush if the default is not desired
    return m_brush;
}'
idoo
  • 310
  • 1
  • 12