如何改变视窗的背景颜色
2008-10-05 14:48
429 查看
Windows向窗口发送一个WM_ERASEBKGND消息通知该窗口擦除背景,可以使用
ClassWizard重载该消息的缺省处理程序来擦除背景(实际是画),并返回TRUE以
防止Windows擦除窗口。
//Paint area that needs to be erased.
BOOL CSampleView : : OnEraseBkgnd (CDC* pDC)
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);
// Get the area that needs to be erased .
CRect reClip ;
pDC—>GetCilpBox (&rcClip);
//Paint the area.
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;
}
ClassWizard重载该消息的缺省处理程序来擦除背景(实际是画),并返回TRUE以
防止Windows擦除窗口。
//Paint area that needs to be erased.
BOOL CSampleView : : OnEraseBkgnd (CDC* pDC)
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);
// Get the area that needs to be erased .
CRect reClip ;
pDC—>GetCilpBox (&rcClip);
//Paint the area.
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;
}
相关文章推荐
- 如何改变对话或窗体视窗的背景颜色
- 如何改变视窗的背景颜色
- [导入]VC6.0中如何改变对话框的背景颜色
- 如何改变对话框的背景颜色
- 教你如何改变终端背景与命令的颜色
- VS2008中如何改变对话框的背景颜色
- 如何改变界面和非按钮控件的背景颜色
- 如何改变UITableViewHeaderFooterView的背景颜色
- MFC 如何改变对话框的默认背景颜色
- JS点击按钮如何改变网页的背景颜色
- WPF中ListView如何改变选中条背景颜色
- 教你如何改变终端背景与命令的颜色
- MFC 如何改变对话框的默认背景颜色
- DataGirdView如何改变选中的CheckBox行的背景颜色:
- 改变背景图像后如何消除各控件的背景颜色
- 控件容器如何点击后改变背景颜色(如LinearLayout...)
- 微信小程序如何实现通过点击view改变背景颜色
- MFC 如何改变对话框的默认背景颜色
- Android如何设置背景透明、开关输入法、改变标题栏颜色、layer-list
- css如何做到 鼠标移动到超链接时,超链接会发生改变,例如改变颜色、字体大小、背景颜色等