C#自定义控件怎么去掉某个属性
展开全部
比如你想改变Labelx的Text属性,不必将整个控件公开吧,只要添加一个访问LabelX.Text的属性就可以啊
[Category("自定义参数设置")]
[Description("获取/设置控件标题提示语控件")]
public LabelX Control_LableTitle
{
get
{
return this.m_ctrlLabel_SavePathTitle;
}
set
{
this.m_ctrlLabel_SavePathTitle = value;
this.lblSavePathTitle.Text = value.Text;
this.lblSavePathTitle.Font = value.Font;
this.lblSavePathTitle.ForeColor = value.ForeColor;
}
}
可以换成
[Category("自定义参数设置")]
[Description("获取/设置控件标题提示语控件")]
public string Control_LableTitle
{
get
{
return this.m_ctrlLabel_SavePathTitle.Text;
}
set
{
this.lblSavePathTitle.Text = value
}
}
如果还不行就将setter方法的那句代码改作用propertyinfo.Setvalue的方法更改控件在设计阶段的更改
[Category("自定义参数设置")]
[Description("获取/设置控件标题提示语控件")]
public LabelX Control_LableTitle
{
get
{
return this.m_ctrlLabel_SavePathTitle;
}
set
{
this.m_ctrlLabel_SavePathTitle = value;
this.lblSavePathTitle.Text = value.Text;
this.lblSavePathTitle.Font = value.Font;
this.lblSavePathTitle.ForeColor = value.ForeColor;
}
}
可以换成
[Category("自定义参数设置")]
[Description("获取/设置控件标题提示语控件")]
public string Control_LableTitle
{
get
{
return this.m_ctrlLabel_SavePathTitle.Text;
}
set
{
this.lblSavePathTitle.Text = value
}
}
如果还不行就将setter方法的那句代码改作用propertyinfo.Setvalue的方法更改控件在设计阶段的更改
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询