Answers
这个比较简单吧,先通过文件创建位图,然后把位图画到想显示该位图的窗口上就行了,实例代码如下:
BOOL LoadMyBitmap( CString strPath, CBitmap *pBitmap )
{
HBITMAP hb = (HBITMAP)LoadImage(::AfxGetApp()->m_hInstance, strPath, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );
if (pBitmap->GetSafeHandle())
{
HGDIOBJ tdb = pBitmap->Detach();
::DeleteObject( tdb );
}
if (NULL != hb)
{
BOOL b = pBitmap->Attach( hb );
return TRUE;
}
return FALSE;
}
if (NULL != m_Bmp.m_hObject)
{
m_HeadLeftBmp.GetBitmap(&bmpHeaderLeft);
mem.SelectObject(&m_HeadLeftBmp);
pDC->StretchBlt(0, 0, bmpHeaderLeft.bmWidth, iHeadHeight,
&mem, 0, 0, bmpHeaderLeft.bmWidth, bmpHeaderLeft.bmHeight, SRCCOPY);
pDC->SetBkMode(TRANSPARENT);
}