Siticone Label
The SiticoneLabel is a specialized extension of the standard Windows Forms Label.
It is optimized for high-performance rendering and specifically engineered to support true transparency, making it ideal for overlaying text on complex backgrounds, gradients, or images.
Transparency & Rendering
Unlike standard labels which often have artifacts when placed over gradients or images, the SiticoneLabel enforces a transparent background and optimized painting.
| Property | Type | Description |
|---|---|---|
BackColor |
Color | label.BackColor = Color.Transparent; Forces the background to be transparent. Attempts to set this to a solid color are automatically overridden to ensure seamless integration with parent controls. |
DoubleBuffered |
bool | Enabled by default. Reduces flicker when the text or the parent container is resized or repainted. |
Appearance & Typography
Standard text properties are fully supported, with defaults tuned for modern UI applications.
| Property | Type | Description & Usage Example |
|---|---|---|
Text |
string | label.Text = "Welcome Back"; The content string displayed by the control. |
Font |
Font | label.Font = new Font("Segoe UI", 12f); Default is Segoe UI, 10pt. This provides a cleaner look compared to the standard MS Sans Serif default. |
ForeColor |
Color | label.ForeColor = Color.White; The color of the text. |
TextAlign |
ContentAlignment | label.TextAlign = ContentAlignment.MiddleCenter; Determines the alignment of text within the control's bounds (e.g., TopLeft, MiddleCenter). |
AutoSize |
bool | label.AutoSize = true; If true, the control resizes automatically to fit its text content. If false, text is wrapped or clipped based on the Size property. |
Designer Features & Smart Tags
The SiticoneLabel includes a robust Smart Tag panel in the Visual Studio designer, allowing for rapid styling and configuration.
| Feature | Description |
|---|---|
Theme Presets |
Quickly apply predefined color schemes via the Smart Tag menu:
|
Quick Formatting |
Direct access to Font and ForeColor dialogs from the Smart Tag, saving clicks in the Properties window. |
Copy/Paste Settings |
Copy Settings: Copies visual properties (Font, Color, etc.) to an internal clipboard. Paste Settings: Applies the copied styles to another SiticoneLabel instance. Note: Does not copy Name or Location properties to preserve layout integrity. |
Detailed Usage Examples
Example 1: Basic Setup & Transparency
This example demonstrates placing a label over a background image (e.g., a PictureBox or a Form with a gradient).
The BackColor is strictly maintained as Transparent.
private void InitializeHeaderLabel()
{
var headerLabel = new SiticoneLabel();
// Basic Text Properties
headerLabel.Text = "Dashboard Overview";
headerLabel.Font = new Font("Segoe UI", 16f, FontStyle.Bold);
headerLabel.ForeColor = Color.White;
// Transparency logic is handled automatically by the control.
// Even if you try to set it to Black, it remains Transparent.
headerLabel.BackColor = Color.Black; // Will be ignored/reset to Transparent
// Positioning
headerLabel.AutoSize = true;
headerLabel.Location = new Point(20, 20);
// Add to a container with a background image
this.Controls.Add(headerLabel);
// Ensure it renders on top of other controls (like a background panel)
headerLabel.BringToFront();
}
Example 2: Dynamic Status Labels (Theming)
A helper method to update a status label's appearance based on application logic. This mimics the functionality of the Designer Smart Tags but at runtime.
public enum StatusType { Normal, Success, Warning, Error }
public void UpdateStatus(SiticoneLabel lbl, string message, StatusType type)
{
lbl.Text = message;
// Apply colors based on status type
switch (type)
{
case StatusType.Success:
lbl.ForeColor = Color.SeaGreen;
break;
case StatusType.Warning:
lbl.ForeColor = Color.Goldenrod;
break;
case StatusType.Error:
lbl.ForeColor = Color.Crimson;
break;
default:
lbl.ForeColor = Color.DimGray;
break;
}
}
// Usage:
UpdateStatus(lblStatus, "Connection Established", StatusType.Success);
Example 3: Cloning Styles
While the designer provides Copy/Paste, you can also replicate styles programmatically to ensure consistency across dynamically created labels.
private SiticoneLabel CreateLabelFromTemplate(SiticoneLabel template, string newText)
{
var newLabel = new SiticoneLabel();
// Copy visual properties
newLabel.Font = template.Font;
newLabel.ForeColor = template.ForeColor;
newLabel.AutoSize = template.AutoSize;
newLabel.TextAlign = template.TextAlign;
// Set unique content
newLabel.Text = newText;
return newLabel;
}