// 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();
}
dc.StretchBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,b.bmWidth,b.bmHeight,SRCCOPY);
memDC.SelectObject(pOldBmp);
/************************************************************/
// Do not call CDialog::OnPaint() for painting messages
}