Skip to content

A Textbox control which shows watermark also when in MultiLine mode.

Notifications You must be signed in to change notification settings

r-aghaei/TextBoxWatermark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TextBox Watermark

In this example I created a TextBox control which shows watermark (hint or cue banner or place holder).

You can set the hint, using Hint property. The control also can show watermark when TextBox is multi-line. You can also set HintColor for the control. The painting will be disappear when the TextBox get focus.

watermark

To show a watermark in a TextBox you can use either of following options:

  • You can send a EM_SETCUEBANNER message to the TextBox
  • You can hanlde WM_PAINT and draw the watermark yourself.

If you use EM_SETCUEBANNER, then there will be 2 problems. The text always will be shown in a system default color. Also the text will not be shown when the TextBox is MultiLine.

Using the painting solution, you can show the text with any color that you want. You also can show the watermark when the control is multile.

About

A Textbox control which shows watermark also when in MultiLine mode.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages