GDI +中发生一般错误 [英] Generic error occured in GDI+

查看:87
本文介绍了GDI +中发生一般错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这将运行一段时间没有问题,然后出现错误

This will run for a while no problem, then I get the error

Private Function CreateIcon(ByVal bitmap As Bitmap) As Icon

        Dim convertedIcon As Icon = Nothing
        convertedIcon = Icon.FromHandle(bitmap.GetHicon)
        Return convertedIcon

    End Function



它只是将位图转换为图标.



It just converts a bitmap into an icon.

推荐答案

GetHicon中的H表示句柄.它返回不是图标的IntPtr.您需要从Hicon获取图标.在此检查msdn,您也可以在此处找到示例代码.
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.gethicon.aspx#Y0 [ ^ ]

祝你好运!
The H in GetHicon means handle. It returns an IntPtr that isn''t an Icon. You need to get the Icon from the Hicon. Check msdn on this, you can also find example code there.
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.gethicon.aspx#Y0[^]

Good luck!


这篇关于GDI +中发生一般错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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