Posted on 2010-09-01 10:50
幻海蓝梦 阅读(781)
评论(0) 编辑 收藏 所属分类:
C++
1、在资源视图中 填加位图
2、在nameDlg.cpp中填加
CBitmap m_bmZD,m_bmBack;
CBrush m_brZD,m_brBack;
和在初始化函数中 BOOL nameDlg::OnInitDialog(){填加
VERIFY(m_bmZD.LoadBitmap(IDB_BG)); // IDB_BG 为位图ID
VERIFY(m_brZD.CreatePatternBrush(&m_bmZD));
VERIFY(m_bmBack.LoadBitmap(IDB_BG));
VERIFY(m_brBack.CreatePatternBrush(&m_bmBack));
3、填加利用向导映射AboutDlg的WM_CTLCOLOR消息,产生函数
HBRUSH nameDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
pDC->SetBkMode(TRANSPARENT);
if (nCtlColor==CTLCOLOR_EDIT)return hbr;
else if(nCtlColor == CTLCOLOR_LISTBOX )
return m_brBack;
return m_brZD;
// TODO: 如果默认的不是所需画笔,则返回另一个画笔
//return hbr;
}
http://blog.ednchina.com/jimmy_qiu/49876/message.aspx