默认的刷新背景是白色的
好象是在OnEraseBng()中,请问一下具体是怎么做的?
谢谢。

解决方案 »

  1.   

    OnCtlColor,返回自己创建的CBrush对象(new 出来的)
      

  2.   


    CBrush mybrush;
    mybrush.CreateSolidBrush(RGB(250,0,0)); //建立红色背景刷
    CDC * dc = GetDC();
    CRect clientrect;
    GetClientRect(&clientrect);
    dc->FillRect(rect,&mybrush);
      

  3.   

    OnEraseBng(...)
    {
        CRect rc;
        GetClientRect(&rc);
        pDC->FillSolidRect(&rc,RGB(255,0,0));//填充红色
        return TRUE;
    }
      

  4.   

    或者这样,一劳永逸
    void CTestView::OnInitialUpdate() 
    {
    CView::OnInitialUpdate();

    // TODO: Add your specialized code here and/or call the base class
    HBRUSH hbr = CreateSolidBrush(RGB(255,0,0));
    SetClassLong(GetSafeHwnd(),GCL_HBRBACKGROUND,(DWORD)hbr);
    }