改变对话框的背景色

1.头文件里定义一个画刷:
CBrush m_brushColor;
2.在OnInitDialog()初始化时创建画刷,并设置实际的颜色:
m_brushColor.CreateSolidBrush ( RGB ( 100, 100, 255 ));//初始化颜色画刷
3.通过类向导添加afx_msg HBRUSH OnCtlColor()函数,并返回颜色刷子:
HBRUSH CxxxDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	if(nCtlColor ==CTLCOLOR_DLG)
	return m_brushColor;  //返回颜色刷子 
}
上一篇:面试官:为什么需要Java内存模型?


下一篇:activemq 控制台报错 java.lang.SecurityException: User name [system] or password is invalid.