Visual studio 属性网格中文件的可编辑完整路径属性-Visual Studio 2008

Visual studio 属性网格中文件的可编辑完整路径属性-Visual Studio 2008,visual-studio,propertygrid,extensibility,Visual Studio,Propertygrid,Extensibility,我在VS2008解决方案中有一个包含文件项的项目。在属性网格中,每个项都有一个名为“FullPath”的标准只读属性 使“特性”栅格的“完整路径”特性可编辑的最简单方法是什么 添加对System.Design的引用 创建类 public class DllFileNameEditor : System.Windows.Forms.Design.FileNameEditor { protected override void InitializeDialog(OpenFileD

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

使“特性”栅格的“完整路径”特性可编辑的最简单方法是什么

  • 添加对System.Design的引用

  • 创建类

    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";
    } }
    
  • 修改属性

    [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