Getting Started

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();
this.Controls.Add(this.textBoxExt);
Private textBoxExt As TextBoxExt
Me.textBoxExt = New Syncfusion.Windows.Forms.Tools.TextBoxExt()
Me.Controls.Add(Me.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"

NOTE

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](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Shared.Base~Syncfusion.Windows.Forms.BannerTextInfo~Visible.html) Indicates whether the banner text should be visible.
[Text](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Shared.Base~Syncfusion.Windows.Forms.BannerTextInfo~Text.html) Sets the banner text.
[Color](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Shared.Base~Syncfusion.Windows.Forms.BannerTextInfo~Color.html) Sets the banner text color.
[Font](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Shared.Base~Syncfusion.Windows.Forms.BannerTextInfo~Font.html) Sets the font style for the banner text.
[Mode](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Shared.Base~Syncfusion.Windows.Forms.BannerTextInfo~Mode.html) 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

NOTE

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