我正在爲Date創建自定義MaskedTextBox。現在我想從其用戶隱藏MaskedTextBox的Mask屬性。如何在創建自定義控件時將預先設置的公共屬性設置爲私有
編輯:
public class CustomDateMask:System.Windows.Forms.MaskedTextBox
{
public new string Mask
{
get;
private set;
}
public CustomDateMask()
{
this.Mask = @"00/00/2\000"; // this property should not be set by any one now
this.ValidatingType = typeof(System.DateTime); // this property should not be set by any one now
}
}
我應該做的,這樣沒有人可以設置該屬性
@nobugz:我們是否需要使用任何命名空間也可以使用System.ComponentModel的可瀏覽 – 2010-02-02 21:52:37
; Visual Studio 2008應該提示你自動添加它,儘管.... – Greg 2010-02-02 21:57:25