MFC基于对话框画图
甘海洋 2014-03-22 09:32:46 void CMyDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
for(int i=0;i<GRID_NUM;i++)
{
dc.MoveTo(BOARD_POS_X,BOARD_POS_Y+i*BOARD_WIDTH);
dc.LineTo(BOARD_POS_X+14*BOARD_WIDTH,BOARD_POS_Y+i*BOARD_WIDTH);}
//SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
求大神解释为什么对话框没有反应