我有一段#pragma managed的VC代码:CBitmap cb;
IntPtr ^ p=gcnew IntPtr(HBITMAP(cb));
Bitmap ^ bmp=Image::FromHbitmap(p);但是最后一行无法把p传进去,编译错误:error C2665: 'System::Drawing::Image::FromHbitmap' : none of the 2 overloads could convert all the argument types
有什么办法把CBitmap的转换成System.Drawing.Bitmap吗?
IntPtr ^ p=gcnew IntPtr(HBITMAP(cb));
Bitmap ^ bmp=Image::FromHbitmap(p);但是最后一行无法把p传进去,编译错误:error C2665: 'System::Drawing::Image::FromHbitmap' : none of the 2 overloads could convert all the argument types
有什么办法把CBitmap的转换成System.Drawing.Bitmap吗?
Bitmap ^ bmp=Image::FromHbitmap(*p);
一句有运行时错误:未处理的“System.Runtime.InteropServices.ExternalException”类型的异常出现在 System.Drawing.dll中。其他信息:GDI+中发生一般性错误。中断后可以看到p是有值的,但是*p是 <未定义的值> void*
如果你为了用.net类库,还不如直接用c#