我有一个类,它的一个属性是一个string,我想在PropertyGrid中显示,重要的是我想让这一行上有一个按钮,一点,可以出选择文件的对话框,或者调用我自己写的一个函数也行。
请问怎么搞啊?谢了先。

解决方案 »

  1.   

    例如:
    [EditorAttribute(typeof(YourTypeEditor), typeof(System.Drawing.Design.UITypeEditor))]
    public string Defname
    {
        get{...}
        set{...}
    }
      

  2.   

    找了一个直接的,楼主试试看:1:在项目里引用System.Design.DLL2:给你的属性添加如下的属性就可以了:
    [EditorAttribute(typeof(FileNameEditor), typeof(UITypeEditor))]
    //you property define
      

  3.   

    太好了,就是这个FileNameEditor。