C++如何修改SDI程序的默认背景颜色
2007-08-26 16:00
435 查看
使用MFC建立的SDI应用程序默认为白色背景,你可以按下列步骤修改为其他背景颜色。
Ctrl+W pops up the MFC classwizard property sheet.
Select the Message Maps tab.
From the drop-down list box under the Class Name static control, select the CxxxView option (xxx = Your project's name; for example, CNnoyeView).
Make sure CxxxView is also selected in the Object ID's list box.
Select the WM_ERASEBKGND option in the Messages list box.
Click the Add Function button. The Class Wizard adds the "OnEraseBkgnd" member function.
Click the Edit Code button. Add the following code before the return CView::OnEraseBkgnd(pDC) statement.
Ctrl+W pops up the MFC classwizard property sheet.
Select the Message Maps tab.
From the drop-down list box under the Class Name static control, select the CxxxView option (xxx = Your project's name; for example, CNnoyeView).
Make sure CxxxView is also selected in the Object ID's list box.
Select the WM_ERASEBKGND option in the Messages list box.
Click the Add Function button. The Class Wizard adds the "OnEraseBkgnd" member function.
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
相关文章推荐
- C++如何修改SDI程序的默认背景颜色
- C++如何修改SDI程序的默认背景颜色
- C++如何修改SDI程序的默认背景颜色
- C++如何修改SDI程序的默认背景颜色
- 修改Chrome浏览器默认背景颜色为浅绿色(转)
- 180331 如何修改pdf背景颜色
- 85.如何更改iOS上的UISearchBar组件的内部背景UITextField颜色 修改UISearchBar删除按钮ClearButton
- 如何修改UIPickerView选中行背景颜色
- 如何修改pdf文件的背景颜色
- C++--如何在Dialog和View中显示梯度背景颜色
- 修改Chrome浏览器默认背景颜色为浅绿色
- Eclipse背景颜色修改:操作界面默认颜色为白色。对于我们长期使用电脑编程的人来说,白色很刺激我们
- MFC 如何改变对话框的默认背景颜色
- 如何在线编辑修改PDF文件中的背景颜色
- 如何修改Eclipse的背景颜色
- 如何修改系统默认店招的背景及其样式?
- 卸载EditPlus,装上Notepad++,如何修改Notepad++背景颜色???
- Yii-bootstrap TbMenu修改默认背景颜色(background-color)
- 修改Chrome浏览器默认背景颜色为豆沙绿护眼色
- 使用setBackground修改applet默认背景颜色