C# 如何根据父对象更改UITypeEditor';谁的财产?
我正在测试,希望根据父对象的属性选择UIType编辑器:C# 如何根据父对象更改UITypeEditor';谁的财产?,c#,winforms,C#,Winforms,我正在测试,希望根据父对象的属性选择UIType编辑器: public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { // Uses the IWindowsFormsEditorService to display a // drop
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
// Uses the IWindowsFormsEditorService to display a
// drop-down UI in the Properties window.
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (edSvc != null)
{
AngleEditorTestControl t = context.Instance as AngleEditorTestControl;
if (t != null)
{
// If the property TestValue is null or empty, the AngleControl is selected
if (String.IsNullOrEmpty(t.TestValue))
{
// Display an angle selection control and retrieve the value.
AngleControl angleControl = new AngleControl(
(bool)context.PropertyDescriptor.GetValue(
context.Instance), edSvc);
edSvc.DropDownControl(angleControl);
return angleControl.Valeur;
}
else
{
// Otherwise I want the default UIType Editor (for Int32, float and double) will be selected
// ...
}
}
}
return value;
}
怎么做
谢谢大家! 你找到答案了吗?我可能会冒险猜测一下,但我不确定默认UITypeEditor是什么意思。是否只是指未指定编辑器属性时显示的常规旧文本框?