62,269
社区成员
发帖
与我相关
我的任务
分享
public class MyLabel : Label
{
[Browsable(false)]
public override string Text
{
get { return base.Text; }
set { throw new InvalidOperationException("请通过Value属性设置。"); }
}
public int Value
{
get
{
string t = base.Text;
if (string.IsNullOrEmpty(t)) return 0;
else return int.Parse(t);
}
set
{
if (value == 0)
base.Text = "";
else
base.Text = value.ToString();
}
}
}