MtRock.cs Paradise 16

Qingshuan’s Programming Blog

[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));

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>