问题描述
这是我的第一个问题,我一直在寻找解决方案2天而且没有。
Im创建一个使用图片框的自定义控件,我试图从属性网格中选择图像...但我收到此错误:
错误2类型或命名空间名称'ImageEditor'在命名空间'System.Drawing.Design'中不存在(你是否缺少程序集引用?)C:\ Users \ Perersons \ ... \ ImageMutton.cs 33 51我的项目
Hi, this is my first question, I've been looking for a solution for 2 days and nothing.
Im creating a custom control that uses a picturebox and im trying to select the image from the property grid... but I get this error:
Error2The type or namespace name 'ImageEditor' does not exist in the namespace 'System.Drawing.Design' (are you missing an assembly reference?)C:\Users\Personal\...\ImageButton.cs3351My Project
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Design;
namespace MyNamespace
{
public partial class ImageButton : UserControl
{
public ImageButton()
{
InitializeComponent();
}
private Image normal;
public string TestString // Just for test if the property is displayed in the property box -and it does -
{
set;
get;
}
// Im getting the error in the next line..
[EditorAttribute(typeof(System.Drawing.Design.ImageEditor),typeof(System.Drawing.Design.UITypeEditor))] // According to http://msdn.microsoft.com/en-us/library/system.drawing.design.imageeditor.aspx
public Image ImageNormal
{
set
{
normal = value;
}
get
{
return normal;
}
}
}
}
我是尝试使用不同版本的.net framework 2.0,3.5,4和同样的问题,我也尝试在不同的PC上使用VS2010 Express Edition和Professional,我也遇到了同样的问题...
我可以以编程方式分配Image属性,但是当我在设计器上显示表单时,我得到另一个错误,说自定义控件类没有名为ImageNormal的属性......但它确实如此..
当我浏览命名空间System.Drawing.Design时,我看不到它应该拥有的所有类(根据 []),仅
I've tried using differents versions of .net framework 2.0, 3.5, 4 and the same problem, also i've tried to use VS2010 Express Edition and Professional on different PCs and im getting the same problem...
I can assign the Image property programmatically, but when I show the form on the designer, I get another error, saying that the custom control class does not have a property called ImageNormal... but it does..
when I browse the namespace System.Drawing.Design I cannot see all the classes that it should have (according to http://msdn.microsoft.com/en-us/library/ks225801[^]), only
CategoryNameCollection
PaintValueEventArgs
PropertyValueUIItem
ToolboxComponentsCreatedEventArgs
ToolboxComponentsCreatingEventArgs
ToolboxItem
ToolboxItemCollection
UITypeEditor
所有Prebuilt UITypeEditors类都是失踪! (BitmapEditor,ColorEditor,ContentAlignmentEditor,CursorEditor,FontEditor,FontNameEditor,IconEditor, ImageEditor ,MetafileEditor)
所以我想知道为什么会发生这种情况我,我说我做错了什么...... APP是一个Windows窗体应用程序。
任何帮助将不胜感激。
PS:打扰一下,如果我的英文有什么不对/怪异的话。
all the Prebuilt UITypeEditors classes are missing! (BitmapEditor, ColorEditor, ContentAlignmentEditor, CursorEditor, FontEditor, FontNameEditor, IconEditor, ImageEditor, MetafileEditor)
so I wonder why is this happenig to me, I supose im doing something wrong... the APP is a Windows Forms Application.
Any help will be appreciated.
PS: Excuse me if there is anything wrong/weird with my English.
推荐答案
这篇关于缺少System.Drawing.Design中的ImageEditor类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!