我想问一下!如何改变程序主界面的背景颜色!

解决方案 »

  1.   

    如果是sdi的话主要是改view窗口的背景色有很多种方法的可以在wm_paint中画,可以在WM_ERASEBKGND中画,可以改变窗口类的背景画刷等faq中有
      

  2.   

    处理WM_ERASEBKGND就行了,在它的响应函数里重画
      

  3.   

    在OnDraw()写入如下代码就可以改变
    //...
    CRect r;
    GetClientRect(&r);
    Brush brush;
    brush.CreateBrush(......//此处定义颜色,我在网吧,记不大清楚,你可以这样试试!
    pDC->rectangle(&r);
      

  4.   

    拿基于对话框的应用程序来说,比如有一个Test的项目,在项目的应用程序类中加入下面一句话:
    BOOL CTestApp::InitInstance()
    {
    AfxEnableControlContainer(); // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.#ifdef _AFXDLL
    Enable3dControls(); // Call this when using MFC in a shared DLL
    #else
    Enable3dControlsStatic(); // Call this when linking to MFC statically
    #endif CTestDlg dlg;
    m_pMainWnd = &dlg;
    SetDialogBkColor(RGB(190,190,100),RGB(0,0,0));//注意,就是这句话
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
    }
    else if (nResponse == IDCANCEL)
    {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
    } // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.
    return FALSE;
    }
      

  5.   

    mingbao!好象不行,显示error C2065: 'SetDialogBkColor' : undeclared identifier
      

  6.   

    请大家帮帮忙,我如何才可改变我对话框的悲景颜色!z在初始化里加SetDialogBkColor(RGB(190,190,100),RGB(0,0,0));这句好象不行!
      

  7.   

    SetDialogBkColor(RGB(190,190,100),RGB(0,0,0));
    在VC7中取消了这个函数
      

  8.   

    BOOL CPIMApp::InitInstance()
    {
    AfxEnableControlContainer(); // Standard initialization this->SetDialogBkColor(RGB(220,233,248));//设置对话框背景颜色 CPIMDlg dlg;
    m_pMainWnd = &dlg;
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
    }
    else if (nResponse == IDCANCEL)
    {
    } // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.
    return FALSE;
    }
      

  9.   

    搭个车问一下:
        怎么改变单文档view窗口的颜色呢?还有怎么改变单文档的工具条的颜色呢?
      

  10.   

    逍遥浪子!不行呀!显示 error C2039: 'SetDialogBkColor' : is not a member of 'CFMXL1Dlg'