PropertyGrid中如何传值
假设有以下这PropertyGrid其中GreetingText是一个自定义控件,它的EditValue中必须获得PropertyGrid其它字段的值,我该怎么做呢?
请大家帮帮忙 --------------------编程问答-------------------- uppupupupupupupup --------------------编程问答--------------------
--------------------编程问答-------------------- 不能直接加在属性中,因为其他地方可能要用到这个属性,而且我是需要对Name进行处理 --------------------编程问答-------------------- UPUPUP --------------------编程问答-------------------- 把所有字段都设为属性,则所有字段都能在自定义的窗体中设置该属性,
class My
{
public string Name {get;set;}
public string GreetingText {get {return "Welcome to " + Name;} }
}
如果是自定义控件中有一个字段Name是用TextBox设置则
--------------------编程问答--------------------
public string Name
{
get{return Name;}
set{
name=value;
this.txtName=name;
}
}
这样就能确保在你设置属性时能直接显示你设置的属性值!
2L正解。
不知道你什么意思,要怎么用到,怎么处理。 --------------------编程问答--------------------
GreetingText绑定的是一个自定义控件,有一个继承自UITypeEditor的Editor,在Editor的EditValue中要取得其它属性的值
补充:.NET技术 , C#