在OnDraw()函数或OnPaint()函数中处理

解决方案 »

  1.   

    这是没有用的,视图稍稍改动就要重画,重画就涉及到设备,你这样是不会有作用的.
    看看这里:
    http://www.vckbase.com/document/doc_view/index.html
      

  2.   

    你应该修改View的系统画刷
    重载View的OnCreate消息,添加如下代码 LOGBRUSH BKBrush;
    BKBrush.lbColor = RGB(0,0,255);
    BKBrush.lbStyle = BS_SOLID;
    BKBrush.lbHatch = NULL;
    HBRUSH hBKBrush = CreateBrushIndirect(&BKBrush);
    SetClassLong(m_hWnd,  GCL_HBRBACKGROUND,(long)hBKBrush);
      

  3.   

    是在OnCtlColor消息句柄返回所需的画刷
      

  4.   

    如何改变视窗的背景颜色
    *******************************
    Windows向窗口发送一个WM_ERASEBKGND消息通知该窗口擦除背景,可以使用ClassWizard重载该消息的缺省处理程序来擦除背景(实际是画),并返回TRUE以防止Windows擦除窗口。
    //Paint area that needs to be erased.
    BOOL CSampleView : : OnEraseBkgnd (CDC* pDC)
    {
    // Create a pruple brush.
    CBrush Brush (RGB (128 , 0 , 128) );  // 你想要的颜色// Select the brush into the device context .
    CBrush* pOldBrush = pDC—>SelcetObject (&brush);CRect reClip;
    pDC—>GetCilpBox (&rcClip);
    pDC—> PatBlt (rcClip.left , rcClip.top , rcClip.Width ( ) , rcClip.Height( ) , PATCOPY );//Unselect brush out of device context .
    pDC—>SelectObject (pOldBrush );// Return nonzero to half fruther processing .
    return TRUE;
    }