zoukankan      html  css  js  c++  java
  • C++如何修改SDI程序的默认背景颜色

    使用MFC建立的SDI应用程序默认为白色背景,你可以按下列步骤修改为其他背景颜色。

    1. Ctrl+W pops up the MFC classwizard property sheet.
    2. Select the Message Maps tab.
    3. From the drop-down list box under the Class Name static control, select the CxxxView option (xxx = Your project's name; for example, CNnoyeView).
    4. Make sure CxxxView is also selected in the Object ID's list box.
    5. Select the WM_ERASEBKGND option in the Messages list box.
    6. Click the Add Function button. The Class Wizard adds the "OnEraseBkgnd" member function.
    7. Click the Edit Code button. Add the following code before the return CView::OnEraseBkgnd(pDC) statement.
    CBrush brNew(RGB(0,0,255));  //Creates a blue brush
    CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brNew);
    
    CRect rc;
    pDC->GetClipBox(rc); // Gets the co-ordinates of the client
                         // area to repaint.
    pDC->PatBlt(0,0,rc.Width(),rc.Height(),PATCOPY);
                         // Repaints client area with current brush.
    pDC->SelectObject(pOldBrush);
    
    return TRUE;    // Prevents the execution of return
                    // CView::OnEraseBkgnd(pDC) statement
     
  • 相关阅读:
    js字符串加解密
    vue 项目 tab切换共用相同组件不刷新数据问题
    工具使用
    2021前端学习指南
    echart一个框里放三个饼图案例
    jquery的网络引用地址
    上传文件-jq
    异步按照同步顺序执行的function
    js加载顺序
    不安分的项目经理
  • 原文地址:https://www.cnblogs.com/xiaomaohai/p/6157207.html
Copyright © 2011-2022 走看看