[C++/.NET] Conversion between System::Drawing::Bitmap & CBitmap, HBITMAP
Posted by linuxprogram on February 12, 2008
Conversion from System::Drawing::Bitmap to CBitmap:
System::Drawing::Bigmap^ bmp = gcnew System::Drawing::Bigmap(filename);
HBITMAP hBmp = (HBITMAP)bmp->GetHbitmap().ToInt32();
CBitmap Bitmap;
Bitmap.Attach(hBmp);
And the Reverse:
System::Drawing::Bitmap::FromHbitmap(System::IntPtr(HBITMAP hbmp));