How can I obtain a HBITMAP or HICON from a Direct2D 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
2014/06/07
3:50 UTC
Read the original article
Hit count: 1094
Is there any way to obtain a HBITMAP
or HICON
from a ID2D1Bitmap *
using Direct2D? I am using this function to load the bitmap.
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