Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1.  
  2. void CDlgRoot::setImageCtl(CStaticEx* wnd, UINT Id)
  3. {
  4.  
  5. if (NULL == Id)
  6. return;
  7.  
  8. Gdiplus::Bitmap* bitmap = CGdiPlusUtil::LoadBitmap(Id);
  9.  
  10. if (bitmap == NULL) return;
  11.  
  12. CRect ImgCorp;
  13. wnd->GetWindowRect(&ImgCorp);
  14. bitmap = getResizeImage(bitmap, ImgCorp.Width(), ImgCorp.Height());
  15.  
  16.  
  17. if (bitmap == NULL) return;
  18.  
  19. HBITMAP hBitmap;
  20. ZeroMemory(&hBitmap, sizeof(HBITMAP));
  21. bitmap->GetHBITMAP(0, &hBitmap);
  22. HBITMAP old = wnd->SetBitmap(hBitmap);
  23.  
  24. if (NULL != old)
  25. ::DeleteObject(old);
  26.  
  27. //if (!bDefaultImage)
  28. //{
  29. ::DeleteObject(hBitmap);
  30. SAFE_DELETE(bitmap);
  31. //}
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement