0

I've a Devexpress TextEdit control that displays a string something like "24 year." I want the text "years" to disappear every time the user clicks inside the text box (for editing purpose). And, I want the text to reappear when the focus is lost. How can i do this?

Thanks in advance

4

1 回答 1

5

我相信您正在使用TextEdit。因此,您可以使用以下代码片段:

textEdit.Properties.DisplayFormat.FormatString = "{0:d2} Year";
textEdit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
textEdit.Properties.Mask.EditMask = "\\d{1,2}";
textEdit.Properties.Mask.IgnoreMaskBlank = false;
textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Regular;
textEdit.Properties.NullText = "Type your age here";

以下是相关的帮助主题:

于 2012-04-10T20:52:08.877 回答