private Unit unitTextBoxHeight = Unit.Empty;
[Category("LabelTextBox")]
[Description("文本框高度")]
public Unit TextBoxHeight {
get { this.EnsureChildControls(); return this.tb.Height; }
set { this.EnsureChildControls(); this.tb.Height = value; }
}
[Category("LabelTextBox")]
[Description("驗證表達式")]
public string ValidateExpression {
get { this.EnsureChildControls(); return this.rev.ValidationExpression; }
set { this.EnsureChildControls(); this.rev.ValidationExpression = value; }
}
透過 EnsureChildControls() 確保子控件 (tb TextBox、rev RegularExpressionValidator) 已建立再存取屬性。驗證表達式可設定如 Email 正則 \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*。