public class MyUIEditor:UITypeEditor
(
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return System.Drawing.Design.UITypeEditorEditStyle.DropDown;
}//这里有3种editstyle
public override object EditValue(ITypeDescriptorContext context,IServiceProvider provider,object value)
{
System.Windows.Forms.Design.IWindowsFormsEditorService iws=
rSystem.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
if(iws!=null)
{
mycontrol con = new mycontrol();//因为是自己定制的control理论上可以实现各种要求
con.setcontainer(iws);//con需要实现这个方法。
iws.DropDownControl(con);//这里需要绑定
}
return value;
}
(
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return System.Drawing.Design.UITypeEditorEditStyle.DropDown;
}//这里有3种editstyle
public override object EditValue(ITypeDescriptorContext context,IServiceProvider provider,object value)
{
System.Windows.Forms.Design.IWindowsFormsEditorService iws=
rSystem.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
if(iws!=null)
{
mycontrol con = new mycontrol();//因为是自己定制的control理论上可以实现各种要求
con.setcontainer(iws);//con需要实现这个方法。
iws.DropDownControl(con);//这里需要绑定
}
return value;
}
有一篇文章也是举例讲了这个,如果以后要用,倒是可以查阅《基于反射机制的PropertyGrid下拉框扩展方法》(电脑知识与技术)
以上都是留作学习使用 。