【问题标题】:Editable FullPath property of a file in the Properties grid - Visual Studio 2008属性网格中文件的可编辑 FullPath 属性 - Visual Studio 2008
【发布时间】:2009-11-06 10:22:46
【问题描述】:

我的 VS 2008 解决方案中有一个项目,其中包含文件项。每个项目在属性网格中都有一个名为“FullPath”的标准只读属性。

使属性网格的 FullPath 属性可编辑的最简单方法是什么?

【问题讨论】:

    标签: visual-studio propertygrid extensibility


    【解决方案1】:
    1. 添加对 System.Design 的引用

    2. 创建类

      public class DllFileNameEditor :
      System.Windows.Forms.Design.FileNameEditor   {         protected override void InitializeDialog(OpenFileDialog openFileDialog)
      {
          base.InitializeDialog(openFileDialog);
          openFileDialog.Filter = "Class Library Files (*.dll) |*.dll|All (*.*) |*.*";
          openFileDialog.Title = "Select Class Library File";
      } }
      
    3. 修改属性

      [Category("Identity")]
      [Description("Dll Location")]
      [EditorAttribute(typeof(DllFileNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
      public string DllName
      {
          get { return this.GraphDoc.DllName; }
          set { this.GraphDoc.DllName = value; }
      }
      

    mgznet.com/EditFullPathProperty.aspx

    【讨论】:

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