在紧凑框架 3.5 中的用户控件中定义自定义设计时编辑器(例如多行文本)

本文关键字:编辑器 文本 自定义 框架 定义 控件 用户 | 更新日期: 2023-09-27 18:35:13

在.NET中,我只会写

[Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string MultiLineText { get; set; }

获取字符串属性的多行编辑器。

但是,在紧凑框架中,这是不可能的,因为不包括System.ComponentModel。我已经有一个DesigntimeAttributes.xmta文件,我想我必须在这里定义它,但我找不到有关如何实现这一点的示例。

在紧凑框架 3.5 中的用户控件中定义自定义设计时编辑器(例如多行文本)

以下 xmta 条目在我的 VS2008 上起作用:

<Property Name="MultiLineText">
  <Browsable>true</Browsable>
  <Editor>
    <BaseType>System.Drawing.Design.UITypeEditor, System.Drawing</BaseType>
    <Type>System.ComponentModel.Design.MultilineStringEditor, System.Design</Type>
  </Editor>
</Property>