c# - 使自定义控件的属性输入类似于多行文本框

标签 c# custom-controls propertygrid

假设我有属性“地址”,我怎样才能像文本框的文本输入一样在表单设计器的属性框中输入它,如下所示:

Textbox input image.

?

最佳答案

EditorAttribute 修饰您的 Address 属性引用 MultilineStringEditor类:

using System.ComponentModel;
using System.Drawing.Design;

[Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
    typeof(UITypeEditor))]
public string Address
{
    get;
    set;
}

关于c# - 使自定义控件的属性输入类似于多行文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4125341/

相关文章:

c# - Windows Phone - 如何获取 HTTP 状态代码?

c# - 如何返回自定义匿名类型?

自定义文本框的 WPF 验证错误模板

c# - PropertyGrid 没有注意到代码中的属性更改?

c# - 如何创建用于属性网格的自定义集合编辑器表单?

c# - 如何在 SSIS 的数据流任务中添加增量行号

c# - EMGU 2.4 中的冲浪特征检测/匹配问题

c# - 如何检查属性是否从自定义控件内部绑定(bind)

iphone - 他们是怎么做到的?...避免无聊、千篇一律的标准 iPhone 应用程序

c# - PropertyGrid 中的 UITypeEditor 具有多选功能