Bunifu Framework Docs
HomePricingFAQsMy Account
  • Introduction
  • Getting started
    • Requirements
    • Installation
    • Installing for .Net 5 & Above
    • Licensing
      • Managing your licenses
      • Bunifu Licensing CLI
      • Bunifu Device Remover (Deprecated)
  • BUNIFU UI
    • Controls
      • Bunifu Button
      • Bunifu Button (variant)
      • Bunifu Cards
      • Bunifu CheckBox
      • Bunifu Circle Progress
      • Bunifu Datagrid View
      • Bunifu Date Picker
      • Bunifu Drop Down
      • Bunifu Flat Button
      • Bunifu Form Caption Button
      • Bunifu Form Control Box
      • Bunifu Form Resize Icon
      • Bunifu Gradient Panel
      • Bunifu Icon Button
      • Bunifu Image Button (New)
      • Bunifu Image Button (Old)
      • Bunifu IOS Switch (1.5.3)
      • Bunifu Label
      • Bunifu Loader
      • Bunifu Picture Box
      • Bunifu Pages
      • Bunifu Panel
      • Bunifu Progress Bar
      • Bunifu Radial Gauge
      • Bunifu Radio Button
      • Bunifu Rating
      • Bunifu Range
      • Bunifu Separator
      • Bunifu Sliders
      • Bunifu Shadow Panel
      • Bunifu Shapes
      • Bunifu Switch (1.5.3)
      • Bunifu ScrollBars
      • Bunifu Toggle Switch
      • Bunifu Toggle Switch (variant)
      • Bunifu Tile Button
      • Bunifu Thin Button (1.5.3)
      • Bunifu ToolTip
      • Bunifu Textbox
      • Bunifu User Control
    • Components
      • Bunifu Color Transition
      • Bunifu Drag
      • Bunifu Elipse [Deprecated]
      • Bunifu Form Dock
      • Bunifu Form Drag
      • Bunifu Form Resizer
      • Bunifu Snackbar
      • Bunifu Transition
  • BUNIFU CHARTS
    • Introduction
      • Quick Tips
    • Chart Components
      • Bunifu Bar Chart
      • Bunifu Bubble Chart
      • Bunifu Canvas Control
      • Bunifu Doughnut Chart
      • Bunifu Horizontal bar Chart
      • Bunifu Line Chart
      • Bunifu Pie chart
      • Bunifu Polar Chart
      • Bunifu Radar Chart
  • BUNIFU DATAVIZ [Deprecated]
    • Basic Charts [Deprecated]
      • Step Line Chart [Deprecated]
      • Step Area Chart [Deprecated]
      • Spline Chart [Deprecated]
      • Pie Chart [Deprecated]
      • Line Chart [Deprecated]
      • Doughnut Chart [Deprecated]
      • Bar Chart [Deprecated]
      • Area Chart [Deprecated]
      • Column Chart [Deprecated]
    • Advanced Charts [Deprecated]
      • Stacked Column 100 Chart [Deprecated]
      • Stacked Column Chart [Deprecated]
      • Stacked Bar Chart 100 [Deprecated]
      • Stacked Bar Chart [Deprecated]
      • Stacked Area Chart 100 [Deprecated]
      • Stacked Area Chart [Deprecated]
      • Scatter Chart [Deprecated]
      • Range Spline Area Chart [Deprecated]
      • Range Column Chart [Deprecated]
      • Range Bar Chart [Deprecated]
      • Range Area Chart [Deprecated]
      • OHLC Chart [Deprecated]
      • Candle Stick Chart [Deprecated]
      • Bubble Chart [Deprecated]
Powered by GitBook
On this page
  • Overview
  • Getting Started
  • Adding Bunifu Label at Design Time
  • Adding Bunifu Label at run time
  • Properties
  • 1. Text
  • 2. Font
  • 3. ForeColor
  • 4. BackColor
  • 5. TextAlign
  • 6. AutoSize
  • 7. AutoSizeHeightOnly
  • 8. AutoEllipsis
  • 9. IsSelectionEnabled
  • 10. AllowParentOverrides
  • Take Away

Was this helpful?

  1. BUNIFU UI
  2. Controls

Bunifu Label

Full plain and HTML-text support for form labels

PreviousBunifu IOS Switch (1.5.3)NextBunifu Loader

Last updated 3 years ago

Was this helpful?

Overview

Bunifu Label is a rich .NET control that allows us to provide rich appealing texts inside our Windows Forms applications. It extends the basic properties of the standard Windows Form Label by adding support for HTML-based text tags and inline CSS styles.

Getting Started

Adding Bunifu Label at Design Time

It's easy to add a Bunifu Label at the designer level. Locate Bunifu Label in your toolbox and drag it to your form as shown below.

Adding Bunifu Label at run time

To add a Bunifu Label on our form at run-time, use the Load event handler of your form to run the following code.

public partial class Form1: Form
{
      public Form1()      {
           InitializeComponent();
      }      
      
      private void Form1_Load(object sender, EventArgs e)
      {
           var newLabel = new Bunifu.UI.WinForms.BunifuLabel();
           newLabel.Text = 'My new label’;
           this.Controls.Add(newLabel);
      }
}

Public Class Form1
    
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 
       
      Dim label As New Bunifu.Framework.UI.BunifuLabel 
      label.Text =’My new label' 
      Me.Controls.Add(label)
            
    End Sub
    
End Class

Let's take a deep dive and get insights into the available properties on Bunifu Label.

Properties

1. Text

This property allows you to get or set a text string for the label control.

Apart from providing a string text, it provides an advanced text styling mechanism that implements the use of HTML tags and inline CSS style capabilities. Here's a list of the supported tags.

Tag

Description

<h1> to <h6>

Defines the text headings

<p>

Defines a paragragh

<br>

Defines a single line break

<strong>

defines text with a bold style

<sub>

Defines a subscript text

<sup>

Defines a superscript text

<li>

Defines a list item used with ordered

lists(<ol>) or unordered lists (<ul>)

Note that the tags are XHTML compliant

To add the CSS styling we use the style attribute of the HTML elements described above. The following is a style that sets the fore-color of a super-script text in the label.

This text contains a colored supercript 
number: 10^<sup style="color:#f72585">45</sup>

2. Font

This property allows you to get or set an array of font styles for the text rendered in the control. You can set, for example, the font-family, the font-size and much more.

3. ForeColor

This property allows you to get or set a color value for the text rendered in the control. It supports the use of RGB and HEX color values.

4. BackColor

This property gets or sets the background color for the label control. By default, the background color value is set to transparent.

5. TextAlign

This property gets or sets the text alignment position of the text rendered in the label control.

For the property to function, ensure that the AutoSize and AutoSizeHeightOnly properties are unchecked.

The available enumerated position values are top-left, top-center, top-right, middle-left, middle-center, middle-right, bottom-left, bottom-center and bottom-right positions.

6. AutoSize

This property gets or sets a boolean value, which when set to true, causes the label control to grow and shrink automatically based on the text's length. By default, the property is set to true.

Setting the property to false, allows you to define a custom size(i.e., the width and height) of the label control.

It is important to set the AutoEllipsis property to true, so that when the text exceeds the set width of the label control, will cause the ellipsis to appear at the right edge of the control.

7. AutoSizeHeightOnly

This property gets or sets a boolean value, which when set to true, causes the label control height to automatically grow and shrink base on the text's line breaks.

Ensure that when using this property, the UseGdiPlusTextRendering property is set to true. This will ensure that all the text content fits within the system's auto-sized height.

8. AutoEllipsis

This property allows you to get or set a boolean value, which when set to true, appends the ellipsis characters (...) at the right edge position of the label control, denoting that the text has exceeded the set width specified in the control.

This property only works when the AutoSize property and AutoSizeHeightOnly property are set to false.

9. IsSelectionEnabled

This property allows you to get or set a boolean value, which when set to true, enables users to select the label's text during the application's run-time.

10. AllowParentOverrides

This property allows you to get or set a boolean value, that when set to true, enables the label control to inherit properties of the parent control.

Take Away

We hope you have gained insights into using Bunifu Label. Should you have feedback or suggestions please send us via chat on the bottom right corner of the screen and we will gladly respond in no time.