Siticone Drag Panel
The SiticoneDragPanel is a versatile container control designed to create modern, borderless application interfaces.
Its primary function is to serve as a custom title bar or handle, enabling users to drag the window by clicking and holding anywhere within the panel.
It also features independent corner radii, high-quality rendering options, and transparency support.
Core Features
Essential functionality that distinguishes this control from a standard Panel.
| Property | Type | Description & Usage Example |
|---|---|---|
FillColor |
Color | dragPanel.FillColor = Color.DodgerBlue; The main background color of the panel. Replaces standard BackColor logic. |
BorderColor |
Color | dragPanel.BorderColor = Color.Gray; The color of the panel's border stroke. |
BorderSize |
int | dragPanel.BorderSize = 2; Width of the border line. Minimum value is 2 pixels. |
Margin |
int | dragPanel.Margin = 5; Internal spacing between the border edge and the drawn content. |
Rounded Corners
Configure the shape of the panel with independent control over each corner radius.
| Property | Type | Description & Usage Example |
|---|---|---|
TopLeftRadius |
int | dragPanel.TopLeftRadius = 15; |
TopRightRadius |
int | dragPanel.TopRightRadius = 15; |
BottomLeftRadius |
int | dragPanel.BottomLeftRadius = 15; |
BottomRightRadius |
int | dragPanel.BottomRightRadius = 15; |
Rendering & Quality
Options to control the visual fidelity and drawing performance.
| Property | Type | Description & Usage Example |
|---|---|---|
HighQuality |
bool | dragPanel.HighQuality = true; Enables anti-aliasing and high-quality bicubic interpolation. Set to false for higher performance on older hardware. |
TextRenderingMode |
TextRenderingHint | dragPanel.TextRenderingMode = TextRenderingHint.AntiAlias; Controls how text inside the panel is drawn (e.g., ClearTypeGridFit, AntiAlias). |
UseTransparentBackground |
bool |
dragPanel.UseTransparentBackground = true;
Enables the WS_EX_TRANSPARENT extended style. Useful for non-rectangular forms or overlays.
|
Native Dragging Capability
The control automatically intercepts WM_NCLBUTTONDOWN messages.
When the user clicks and holds the left mouse button on this panel, it sends a signal to the operating system to treat the click as if it were on a window's title bar.
This allows the parent form to be moved seamlessly without requiring custom event handlers.
Detailed Usage Examples
Example 1: Custom Title Bar
The most common use case: replacing the standard Windows title bar with a custom, draggable panel.
public InitializeTitleBar()
{
// 1. Configure the form
this.FormBorderStyle = FormBorderStyle.None;
// 2. Setup the DragPanel
siticoneDragPanel1.Dock = DockStyle.Top;
siticoneDragPanel1.Height = 40;
siticoneDragPanel1.FillColor = Color.FromArgb(30, 30, 35);
siticoneDragPanel1.BorderColor = Color.FromArgb(60, 60, 65);
// 3. Rounded top corners only (for modern look)
siticoneDragPanel1.TopLeftRadius = 10;
siticoneDragPanel1.TopRightRadius = 10;
siticoneDragPanel1.BottomLeftRadius = 0;
siticoneDragPanel1.BottomRightRadius = 0;
// The dragging functionality works automatically due to the internal
// SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0) logic.
}
Example 2: Rounded Floating Card
Creates a visually distinct container for content, appearing like a "card" or widget.
private void CreateCard()
{
var card = new SiticoneDragPanel();
// Size and Position
card.Size = new Size(300, 200);
card.Location = new Point(50, 50);
// Visual Style
card.FillColor = Color.White;
card.BorderColor = Color.LightGray;
card.BorderSize = 2;
// Uniform rounding
card.TopLeftRadius = 20;
card.TopRightRadius = 20;
card.BottomLeftRadius = 20;
card.BottomRightRadius = 20;
// High rendering quality for smooth curves
card.HighQuality = true;
this.Controls.Add(card);
}
Example 3: Transparent Overlay
Using the transparency feature to create a non-rectangular, draggable shape.
private void SetupFloatingButton()
{
siticoneDragPanel1.UseTransparentBackground = true;
siticoneDragPanel1.BackColor = Color.Transparent;
siticoneDragPanel1.FillColor = Color.Crimson;
// Make it a perfect circle
siticoneDragPanel1.Size = new Size(60, 60);
siticoneDragPanel1.TopLeftRadius = 30;
siticoneDragPanel1.TopRightRadius = 30;
siticoneDragPanel1.BottomLeftRadius = 30;
siticoneDragPanel1.BottomRightRadius = 30;
}