如何将属性定义为图像数据类型? [英] How to define a property as an Image data type?

查看:100
本文介绍了如何将属性定义为图像数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private Image _picture;

public Image Picture

{

get

{

返回_picture;

}

设定

{

_picture = value;

}

}



我已声明使用System.Drawing在文件的顶部。但它不会接受它。
不接受它。事实上,Intellisense甚至不承认

System.Drawing。



是否无法将属性声明为图片类型?





公共图片图片

{

get

{

return _picture;

}

set

{

_picture = value;

}

}



我已宣布使用系统 .Drawing"在文件的顶部。但它不会接受它。
不接受它。事实上,Intellisense甚至不承认

System.Drawing。



是否无法将属性声明为图像类型?

解决方案

检查您的引用:您是否包含对System.Drawing的引用(在System.Drawing.dll中)


< blockquote> Intellisense没有显示System.Drawing的原因几乎肯定与你的项目......创建时有关......没有对该dll的有效引用;或者,它已从项目的引用中删除。



在Visual Studio中打开解决方案资源管理器,在树视图中打开引用节点:如果你没有看到System.Drawing在活动项目dll的下拉列表中,然后右键单击References,选择Add Reference,这将打开Reference Manager:找到并添加System.Drawing.dll。


private Image _picture;
public Image Picture
{
get
{
return _picture;
}
set
{
_picture = value;
}
}

where I've declared "using System.Drawing" at the top of the file. But it
won't accept it. In fact, Intellisense doesn't even recognize
"System.Drawing".

Is it not possible to declare a property as an Image type?


public Image Picture
{
get
{
return _picture;
}
set
{
_picture = value;
}
}

where I've declared "using System.Drawing" at the top of the file. But it
won't accept it. In fact, Intellisense doesn't even recognize
"System.Drawing".

Is it not possible to declare a property as an Image type?

解决方案

Check your references: have you included a reference to System.Drawing (in System.Drawing.dll)


The reason Intellisense is not showing System.Drawing is almost certainly related to the fact that your project ... when it was created ... did not have an active reference to that dll; or, somehow it has been deleted from the project's references.

Open the Solution Explorer in Visual Studio, open the References node in the treeview: if you don't see System.Drawing in the drop-down list of active project dll's, then right-click on References, select Add Reference, which will open the Reference Manager: find and add the System.Drawing.dll.


这篇关于如何将属性定义为图像数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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