Getting Started with Windows Forms Gradient Label

11 Oct 20223 minutes to read

This section briefly describes how to create a new Windows Forms project in Visual Studio and add the GradientLabel control 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 the GradientLabel control via designer

The following steps describe how to create a GradientLabel control via designer:

  1. Create a new Windows Forms application in Visual Studio.

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

    • Syncfusion.Grid.Base
    • Syncfusion.Grid.Windows
    • Syncfusion.Shared.Base
    • Syncfusion.Shared.windows
    • Syncfusion.Tools.Base
    • Syncfusion.Tools.Windows

Drag and drop GradientLabel from toolbox

Adding the GradientLabel control via code

The following steps describe how to create the GradientLabel control programmatically:

  1. Create a C# or VB application via Visual Studio.

  2. Add the following assembly references to the project:

    • Syncfusion.Grid.Base
    • Syncfusion.Grid.Windows
    • Syncfusion.Shared.Base
    • Syncfusion.Shared.windows
    • Syncfusion.Tools.Base
    • Syncfusion.Tools.Windows
  3. Include the required namespace.

    using Syncfusion.Windows.Forms.Tools;
    Imports Syncfusion.Windows.Forms.Tools
  4. Create an instance of the GradientLabel control, and add it to the form.

    private Syncfusion.Windows.Forms.Tools.GradientLabel gradientLabel1;
    this.gradientLabel1 = new Syncfusion.Windows.Forms.Tools.GradientLabel();
    this.Controls.Add(this.gradientLabel1);
    Private gradientLabel1 As Syncfusion.Windows.Forms.Tools.GradientLabel
    Me.gradientLabel1 = New Syncfusion.Windows.Forms.Tools.GradientLabel()
    Me.Controls.Add(Me.gradientLabel1)

Gradient settings

The background of the GradientLabel control can be customized using the various options provided by the following properties: GradientStyle, BackColor, and ForeColor.

this.gradientLabel1.Size = new System.Drawing.Size(120, 46);
this.gradientLabel1.BackgroundColor = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Horizontal, System.Drawing.Color.Red, System.Drawing.Color.MediumBlue);
this.gradientLabel1.Text = "Syncfusion Control";
this.gradientLabel1.ForeColor = System.Drawing.Color.SeaShell;
Me.gradientLabel1.Size = New System.Drawing.Size(120, 46)
Me.gradientLabel1.BackgroundColor = New Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Horizontal, System.Drawing.Color.Red, System.Drawing.Color.MediumBlue)
Me.gradientLabel1.ForeColor = System.Drawing.Color.SeaShell

Windows Forms GradientLabel shows grdient style