我的VS 2008解决方案中有一个包含文件项目的项目。每个项目在属性网格中都有一个名为“FullPath”的标准只读属性。
使Properties Grid的FullPath属性可编辑的最简单方法是什么?
答案 0 :(得分:1)
添加对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