HypernovaDesktop Components · docs
Binarymission
WinForms › Extended Label

Extended Label

.NET Framework 4.8.NET 6 / 8 / 10v2.0.0WinForms

A label for headings, captions and status panels that can draw a gradient background, a border, a drop shadow, and text turned on its side.

4public types
40public members
1namespaces

Assembly

AssemblyBinarymission.WinForms.Controls.BinaryExtendedLabel.dll
Root namespaceBinarymission.WinForms.Controls.Containers
Target frameworks.NET Framework 4.8, .NET 6 / 8 / 10

Overview

What it is for

Use it where a plain Label is too flat: a section heading on a settings page, a caption tile on a dashboard ("Open orders: 42"), or a vertical title down the edge of a panel. It is drawn entirely by the control, so the background, border, shadow and text can be styled independently.

The parts

The shadow and the border are on by default, so a new label shows a black one-pixel border with a soft grey shadow. Set ShouldDrawDropShadow and ShouldDrawBorder to false for a flat caption. The label is left out of the tab order.

Getting started

using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using Binarymission.WinForms.Controls.Containers;

public class SalesDashboard : Form
{
    public SalesDashboard()
    {
        Text = "Today's sales";
        ClientSize = new Size(360, 260);

        // A caption tile with a blue gradient and a soft shadow.
        var openOrders = new ExtendedLabel
        {
            Text = "Open orders\n42",
            Location = new Point(60, 20),
            Size = new Size(200, 80),
            Font = new Font("Segoe UI", 12f, FontStyle.Bold),
            ForeColor = Color.White,
            StartLinearGradientBackgroundColor = Color.SteelBlue,
            EndLinearGradientBackgroundColor = Color.MidnightBlue,
            BackgroundGradientFloatAngle = 90f,
            TextAlignment = ContentAlignment.MiddleCenter,
            BorderColor = Color.MidnightBlue,
            DropShadowMargin = 5
        };

        // A vertical title down the left edge, with no shadow or border.
        var sideTitle = new ExtendedLabel
        {
            Text = "Northern region",
            Location = new Point(12, 20),
            Size = new Size(220, 32),
            ShouldDrawDropShadow = false,
            ShouldDrawBorder = false,
            Orientation = ExtendedLabel.DrawingOrientation.Vertical,   // swaps Width and Height
            VerticalTextDirection = ExtendedLabel.TextDirection.BottomTop
        };

        Controls.Add(openOrders);
        Controls.Add(sideTitle);
    }
}

API reference

Binarymission.WinForms.Controls.Containers

class ExtendedLabelA label for headings, captions and status panels that can draw a gradient background, a border, a drop shadow, and text turned on its side.
enum BorderStyleThe weights of border an ExtendedLabel can draw.
enum DrawingOrientationWhich way the text of an ExtendedLabel runs.
enum TextDirectionWhich way vertical text in an ExtendedLabel reads.