【问题标题】:Show multi-line text editor for a string property of my user control in property grid在属性网格中为我的用户控件的字符串属性显示多行文本编辑器
【发布时间】:2015-12-27 15:29:05
【问题描述】:

如何在属性网格中为我的用户控件的字符串属性显示文本编辑器,如下所示:

【问题讨论】:

标签: c# .net winforms visual-studio windows-forms-designer


【解决方案1】:

您应该为您的字符串属性注册MultilineStringEditorUITypeEditor,使用Editor 属性,这样:

[Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
public string MyProperty {get;set;} 

这样做:

  • 你项目的Target Framework应该是一个完整的框架,比如.Net Framework 4.0
  • System.Design 引用添加到您的项目。
  • 使用添加:

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

【讨论】:

    【解决方案2】:

    我不确定你的意思我认为建议你解释更多。但如果您想在表单中显示文本,请从工具箱菜单中选择标签。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多