Getting Started with Windows Forms Watermark Text Provider (BannerText)

This section briefly describes how to create a new Windows Forms project in Visual Studio and add BannerTextProvider with its basic functionalities.

Assembly deployment

Refer to the control dependencies section to get the list of assemblies or the details of NuGet package that needs to be added as reference to use the control in any application.

Refer to this documentation to find more details about installing nuget packages in a Windows Forms application.

Adding a BannerTextProvider control via designer

1) Create a new Windows Forms application using Visual Studio.

2) Add the the BannerTextProvider control to an application by dragging it from the toolbox to design view. The following dependent assembly will be added automatically:

  • Syncfusion.Shared.Base

Drag and drop BannerTextProvider from toolbox

3) Drag a component from toolbox and add to the form. For example, you can choose TextBoxExt control and get an extender provider property as illustrated in the following sample.

Windows Forms BannerTextProvider showing set the banner text to TextBoxExt control

Adding a BannerTextProvider control via code

1) Create a C# or VB application using Visual Studio.

2) Add the following assembly reference to the project:

  • Syncfusion.Shared.Base

3) Include the required namespace.

using Syncfusion.Windows.Forms;
Imports Syncfusion.Windows.Forms

4) Create an instance of the BannerTextProvider control.

private BannerTextProvider bannerTextProvider;
this.bannerTextProvider = new Syncfusion.Windows.Forms.BannerTextProvider(this.components);
Private bannerTextProvider As BannerTextProvider
Me.bannerTextProvider = New Syncfusion.Windows.Forms.BannerTextProvider(Me.components)

Assigning banner text to a control

1) First, add a control to the form. For example, you can choose TextBoxExt control. Create an instance of TextBoxExt, and add it to the form.

private TextBoxExt textBoxExt;
this.textBoxExt = new Syncfusion.Windows.Forms.Tools.TextBoxExt();
Private textBoxExt As TextBoxExt
Me.textBoxExt = New Syncfusion.Windows.Forms.Tools.TextBoxExt()

2) Assign the banner text to the control.

// Textbox is the control used for example.
BannerTextInfo info = bannerTextProvider1.GetBannerText(this.textBoxExt);
info.Text = "New Banner Text";
' Textbox is the control used for example.
Dim info As BannerTextInfo = bannerTextProvider1.GetBannerText(Me.textBoxExt)
info.Text = "New Banner Text"


Make sure to clear the default value of the Text property of the controls before setting the banner text.

The following extender properties allow you to customize the banner text:

Property Description
[Visible]( Indicates whether the banner text should be visible.
[Text]( Sets the banner text.
[Color]( Sets the banner text color.
[Font]( Sets the font style for the banner text.
[Mode]( Specifies the rendering mode of the banner text. The modes are,
1. FocusMode - The banner text disappears when the control gets focus.
2. EditMode - The banner text disappears only when the control is in Edit mode or when the associated text box is not empty.
this.bannerTextProvider1.SetBannerText(this.textBoxExt, new Syncfusion.Windows.Forms.BannerTextInfo("Type Here...", true, new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Italic), System.Drawing.Color.RoyalBlue, Syncfusion.Windows.Forms.BannerTextMode.EditMode));
Me.bannerTextProvider1.SetBannerText(Me.textBoxExt, New Syncfusion.Windows.Forms.BannerTextInfo("Type Here...", True, New System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Italic), System.Drawing.Color.RoyalBlue, Syncfusion.Windows.Forms.BannerTextMode.EditMode))

Windows Forms BannerTextProvider showing bannertext to TextBoxExt control


BannerText feature can be made available for the following controls only.