This simple extension adds a TextBox control with watermark support to your Visual Studio 2010 WinForms Toolbox under the Common Controls tab It's a basic TextBox control extended with a single property, Watermark. A watermark is a placeholder text which is displayed when the textbox isempty and out of focus.
You can also set the watermark in code at runtime
C# Edit|Remove csharppublic MainWindow(){ InitializeComponent(); SetWatermark("Enter a text here...");}private void SetWatermark(string watermark){ watermarkTextBox1.Watermark = watermark;} public MainWindow() { InitializeComponent(); SetWatermark("Enter a text here..."); } private void SetWatermark(string watermark) { watermarkTextBox1.Watermark = watermark; } |