[DevExpress] sets the watermark text for TextEdit, devexpresstextedit
Key code:
public static void SetWatermark(this TextEdit textEdit, string watermark) { textEdit.Properties.NullValuePromptShowForEmptyValue = true; textEdit.Properties.NullValuePrompt = watermark; } public static void ClearWatermark(this TextEdit textEdit) { if (textEdit.Properties.NullValuePromptShowForEmptyValue) textEdit.Properties.NullValuePrompt = string.Empty; }
Test code:
Private void formateload (object sender, EventArgs e) {textEdit1.SetWatermark ("Enter the user name .... "); textEdit2.SetWatermark (" enter your password .... ");} private void simplebutton#click (object sender, EventArgs e) {textEdit1.ClearWatermark (); textEdit2.ClearWatermark ();}
Code effect:
In DevExpress, how does one obtain the attributes of TextEdit?
For example, your TextEdit Name = textID value: string id = this. textID. Text;
Set the amount format for TextEdit in the devExpress control package
DisplayFormat = "{0: c2 }"