一个对话框的程序。
我响应WM_NCPAINT消息。
void CASDDlg::OnNcPaint()
{
CDialog::OnNcPaint();
CWindowDC dc( this );
imgList.Create( IDB_BITMAP5, 16, 2, RGB( 255, 0, 255 ) );
imgList.Draw( &dc, 0, CPoint( 5, 10 ), ILD_TRANSPARENT );
}
不能再标题栏上画出来,但如果我去掉CDialog::OnNcPaint(); ,..........就能画出来。但是标题栏的其它东西又没了。
要怎么办呢?搞了一天了。
------解决思路----------------------
void CTransDlgDlg::OnNcPaint()
{
// TODO: Add your message handler code here
#if 1
CDialog::OnNcPaint();
// TODO: Add your message handler code here
CWindowDC dc(this);
CRect rcWin;
GetWindowRect(rcWin);
rcWin.OffsetRect(-rcWin.TopLeft());
CBrush br;
br.CreateSolidBrush(RGB(255,0,0));
// 3 pixels 红框
dc.FrameRect(rcWin, &br);
rcWin.DeflateRect(1,1);
dc.FrameRect(rcWin, &br);
rcWin.DeflateRect(1,1);
dc.FrameRect(rcWin, &br);
// Do not call CDialog::OnNcPaint() for painting messages
#endif
//#if 0
// CDialog::OnNcPaint();
// CWindowDC dc( this );
m_imgList.Draw( &dc, 0, CPoint(rcWin.Width()/2, 7 ), ILD_TRANSPARENT );// "2"
//#endif
}
//初始化
// TODO: Add extra initialization here
m_imgList.Create( IDB_BITMAP2, 16, 2, RGB( 255, 255, 255 ) );
//定义
protected:
HICON m_hIcon;
CImageList m_imgList;