加载图片 并显示
在OnInitDiloag中
hbmp = SHLoadDIBitmap(TEXT("//System2//logo_off.bmp"));
if( hbmp == NULL )
{
CString str;
str.Format(L"error is %d",GetLastError());
MessageBox(str,0,0);
}
在onPaint中完成
void Time::OnPaint()
{
//CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
CDC *pdc = GetDC();
HDC hdc;
BITMAP bitmap;
CBitmap *bmp = (CBitmap::FromHandle(hbmp));
bmp->GetBitmap(&bitmap);
hdc = CreateCompatibleDC(*pdc);
SelectObject(hdc,hbmp);
BitBlt(*pdc,0,0,bitmap.bmWidth,bitmap.bmHeight,hdc,0,0,SRCCOPY);
FlagOfPaint = 0;
}
里面关于到一些 dc 和 图片的使用 刚开始用 MFC 的 挺实用