如何将VB.Net的CType()转换为C#
发布时间:2020-12-17 00:05:30 所属栏目:大数据 来源:网络整理
导读:我在VB NET中有这段代码: CType(pbImageHolder.Image,Bitmap).SetPixel(curPoint.X,curPoint.Y,Color.Purple) 什么是C#中的适当代码? 先谢谢你. 在VB.Net中,CType(object,type)将对象强制转换为特定类型. 在C#中有两种方法可以实现这一点: Bitmap image =
我在VB NET中有这段代码:
CType(pbImageHolder.Image,Bitmap).SetPixel(curPoint.X,curPoint.Y,Color.Purple) 什么是C#中的适当代码? 先谢谢你.
在VB.Net中,CType(object,type)将对象强制转换为特定类型.
在C#中有两种方法可以实现这一点: Bitmap image = pbImageHolder.Image as Bitmap; image.SetPixel(curPoint.X,Color.Purple); 要么 Bitmap image = (Bitmap)(pbImageHolder.Image); image.SetPixel(curPoint.X,Color.Purple); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |