属性网格中文件的可编辑 FullPath 属性 - Visual Studio 2008

发布于 2024-08-10 00:39:32 字数 109 浏览 3 评论 0原文

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

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

I have a project in my VS 2008 solution containing file items. Each item have a standard read only property called "FullPath" in the Properties Grid.

What is the easiest way to make the FullPath property of the Properties Grid editable?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风铃鹿 2024-08-17 00:39:32
  1. 添加对 System.Design 的引用

  2. 创建类

    公共类 DllFileNameEditor :
    System.Windows.Forms.Design.FileNameEditor { protected override void InitializeDialog(OpenFileDialog openFileDialog)
    {
        base.InitializeDialog(openFileDialog);
        openFileDialog.Filter = "类库文件(*.dll) |*.dll|全部(*.*) |*.*";
        openFileDialog.Title = "选择类库文件";
    } }
    
  3. 修改属性

    [类别(“身份”)]
    [描述(“DLL 位置”)]
    [EditorAttribute(typeof(DllFileNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
    公共字符串 DllName
    {
        获取 { 返回 this.GraphDoc.DllName; }
        设置 { this.GraphDoc.DllName = 值; }
    }
    

mgznet.com/EditFullPathProperty.aspx

  1. Add reference to System.Design

  2. Create class

    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. Modify property

    [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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文