0

我需要在 mfc 中创建一个自定义对话框,它的外观与通常的 MFC 对话框不同。例如颜色应该是蓝色、样式等。这可能吗?我怎样才能做到这一点?

4

1 回答 1

1

我用谷歌搜索了背景颜色:
这里

//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;
}'
于 2013-03-14T09:09:28.200 回答