将位图转换为intptr [英] converting bitmap to intptr
本文介绍了将位图转换为intptr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在C#中将位图转换为intptr?如果答案是肯定的,请告诉我解决方案,如果答案是否定的,请告诉我如何将穿刺盒加载的图像转换为intptr.
Is it possible to convert bitmap to intptr in c#? If the answer is yes, please tell me the solution and if the answer is no,please tell me how I can conert the image loaded by piocture box to intptr.
推荐答案
如果这是System.Drawing.Bitmap
,请使用GetHbitmap
.
同样,问题是:为什么?有可能,您想要使用纯.NET库执行的操作.另外,请仔细检查您是否真的要使用PictureBox
.如果您想操纵图像,设置动画或进行交互操作,PictureBox
只会吃掉一些额外的资源,但不会提供任何帮助,只会增加一些麻烦.在过去的解决方案中,我对此进行了解释,同时也解释了如何做:
如何将图像保留在PictureBox中 [ ^ ],
图片框重新加载后会丢失图纸 [如何从旧图纸中清除面板 [ ^ ].
—SA
If this isSystem.Drawing.Bitmap
, useGetHbitmap
.
Again, the question is: why? Chances are, what you want you can do using pure .NET libraries. Also, check up carefully if you really want to usePictureBox
. If you want to manipulate image, or animate or do anything interactive,PictureBox
will only eat up some extra resources but won''t provide any help, will only add some hassles. I explained it, and also explained what to do instead, in my past solutions:
How to keep the image Drawn in PictureBox[^],
Picture box lose drawing after reloading[^],
How do I clear a panel from old drawing[^].
—SA
这篇关于将位图转换为intptr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文