如何将位图转换为IntPtr? [英] How do I convert a Bitmap to an IntPtr?

查看:81
本文介绍了如何将位图转换为IntPtr?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将位图图像作为转换为IntPtr的输入参数传递到非托管代码段(导出的DLLImport函数)中. DllImport函数是用C ++编写的.我试图将位图转换为字节[],然后转换为IntPtr,但没有成功.

I need to have a bitmap image being passed into a Unmanaged code segement (exported DLLImport function) as an input parameter converted to a IntPtr. The DllImport function is written in C++. I tried to convert the bitmap to a byte [] and then to a IntPtr without success.

推荐答案

使用此方法:
Use this:
IntPtr handle = bitmap.GetHbitmap();


这篇关于如何将位图转换为IntPtr?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆