Siticone Flat Panel
The SiticoneFlatPanel is a lightweight, highly-optimized container control designed for performance and transparency.
Unlike standard panels, it comes pre-configured with Double Buffering and Transparency Support,
eliminating flicker during resizing and allowing for seamless overlays on complex backgrounds. It removes 3D borders by default for a modern, flat aesthetic.
Core Features & Behavior
This control inherits directly from System.Windows.Forms.Panel but modifies the low-level painting behavior.
| Feature | Type | Description & Technical Detail |
|---|---|---|
Double Buffered |
Style |
Enabled by default. Sets OptimizedDoubleBuffer | AllPaintingInWmPaint to ensure the panel redraws without flickering, especially useful when moving or resizing.
|
Transparency |
Style |
Sets SupportsTransparentBackColor to true. Allows the BackColor property to accept Color.Transparent, letting underlying form content show through.
|
Flat Rendering |
Style | Designed for flat UI/UX. It defaults to no borders (unless manually added via Paint event) and uses user-paint logic for maximum control. |
Key Properties
Standard properties pre-configured for the "Flat" look.
| Property | Type | Description & Usage Example |
|---|---|---|
BackColor |
Color | flatPanel.BackColor = Color.Transparent; Defaults to Transparent. Can be set to semi-transparent colors (ARGB) for glass-like effects. |
MinimumSize |
Size | flatPanel.MinimumSize = new Size(20, 20); Enforced minimum dimension to prevent the panel from vanishing completely during dynamic layouts. |
DoubleBuffered |
bool | flatPanel.DoubleBuffered = true; Exposed from base class but forced to true in constructor. |
Detailed Usage Examples
Example 1: Transparent Overlay
Using the FlatPanel as a container for floating controls over an image background.
private void SetupOverlay()
{
var overlay = new SiticoneFlatPanel();
// Position over existing content
overlay.Dock = DockStyle.Fill;
// Semi-transparent black background
overlay.BackColor = Color.FromArgb(150, 0, 0, 0);
// Add content to the overlay
var label = new Label
{
Text = "Loading...",
ForeColor = Color.White,
AutoSize = true,
Location = new Point(100, 100)
};
overlay.Controls.Add(label);
this.Controls.Add(overlay);
overlay.BringToFront();
}
Example 2: Custom Drawing Surface
Since SiticoneFlatPanel is optimized for painting, it is an excellent surface for custom GDI+ drawing (e.g., custom borders, shapes) without the overhead of standard panels.
private void siticoneFlatPanel1_Paint(object sender, PaintEventArgs e)
{
// Enable High Quality Rendering
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
// Draw a custom rounded border manually
using (var pen = new Pen(Color.DodgerBlue, 2))
{
var rect = siticoneFlatPanel1.ClientRectangle;
rect.Inflate(-2, -2); // Padding for border
e.Graphics.DrawRectangle(pen, rect);
}
// Draw a circle in the center
e.Graphics.FillEllipse(Brushes.Orange, 50, 50, 20, 20);
}
Example 3: Lightweight Layout Container
Using the FlatPanel to group buttons without adding visual noise or borders.
private void CreateToolbar()
{
var toolbar = new SiticoneFlatPanel();
toolbar.Dock = DockStyle.Top;
toolbar.Height = 40;
toolbar.Padding = new Padding(5);
toolbar.BackColor = Color.WhiteSmoke;
// Add standard buttons
for (int i = 0; i < 3; i++)
{
var btn = new Button
{
Text = "Action " + i,
Dock = DockStyle.Left,
FlatStyle = FlatStyle.Flat
};
toolbar.Controls.Add(btn);
}
this.Controls.Add(toolbar);
}