C# 以图像作为属性的自定义控件
我正在处理一个C# 以图像作为属性的自定义控件,c#,image,properties,custom-controls,C#,Image,Properties,Custom Controls,我正在处理一个自定义控件,它应该有一个属性,它是一个图像 public Image BackgroundPicture{ set; get }; 但是当图像设置为(无)时,Visual Studio设计器会抛出一个错误: “System.String”类型的对象无法转换为“System.Drawing.Image”类型 有没有有效的方法来防止这个问题
自定义控件
,它应该有一个属性
,它是一个图像
public Image BackgroundPicture{ set; get };
但是当图像
设置为(无)
时,Visual Studio设计器会抛出一个错误:
“System.String”类型的对象无法转换为“System.Drawing.Image”类型
有没有有效的方法来防止这个问题