1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| //Affichage de l'image en couleur
void CcameraDlg::OnBnClickedButton6()
{
CDC * pDC = GetDC();
HBITMAP Hbitmap=SHLoadImageFile(_T("\\My Documents\\test.jpg"));
if(Hbitmap)
{
CBitmap bitmap;
bitmap.Attach(Hbitmap);
BITMAP bmpInfo;
bitmap.GetBitmap(&bmpInfo);
CDC bitmapDC;
bitmapDC.CreateCompatibleDC(pDC);
bitmapDC.SelectObject(&bitmap);
CRect RC;
GetClientRect(&RC);
pDC->StretchBlt(0, 0, RC.Width(), RC.Height(), &bitmapDC,
0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, SRCCOPY);
bitmapDC.DeleteDC();
bitmap.DeleteObject();
}
} |
Partager