Obtaining a HBITMAP/HICON from D2D Bitmap
Posted
by
Tom
on Game Development
See other posts from Game Development
or by Tom
Published on 2012-11-16T05:19:59Z
Indexed on
2012/11/16
11:14 UTC
Read the original article
Hit count: 385
Is there any way to obtain a HBITMAP or HICON from a ID2D1Bitmap* using Direct2D?
I am using the following function to load a bitmap: http://msdn.microsoft.com/en-us/library/windows/desktop/dd756686%28v=vs.85%29.aspx
The reason I ask is because I am creating my level editor tool and would like to draw a PNG image on a standard button control.
I know that you can do this using GDI+:
HBITMAP hBitmap;
Gdiplus::Bitmap b(L"a.png");
b.GetHBITMAP(NULL, &hBitmap);
SendMessage(GetDlgItem(hDlg, IDC_BUTTON1), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);
Is there any equivalent, simple solution using Direct2D? If possible, I would like to render multiple PNG files (some with transparency) on a single button.
© Game Development or respective owner