Siticone Empty Form
The SiticoneEmptyForm is a foundational component for building modern, borderless Windows Forms applications.
Inheriting directly from the standard System.Windows.Forms.Form, it provides a streamlined canvas that automatically manages system shadow composition and rendering optimizations.
By using this base class, developers can bypass the complexity of manually configuring borderless windows, allowing them to focus immediately on UI/UX design while the component handles the underlying window styles and performance tuning.
Public Features
Key capabilities available immediately upon inheritance.
| Feature | Description |
|---|---|
Smart Shadow System |
The form automatically renders a native system drop shadow around the window. This provides depth and visual separation from the desktop background, a feature typically missing from standard borderless forms. |
Optimized Rendering |
Initialized with high-performance control styles including OptimizedDoubleBuffer. This drastically reduces visual tearing and flickering when resizing the form or redrawing complex child controls.
|
Transparency Support |
Fully supports TransparentBackColor. This enables the creation of non-rectangular window shapes (such as rounded corners or circular widgets) without visual artifacts.
|
Clean Initialization |
The form initializes with a clean Color.White background and no borders (FormBorderStyle.None), providing an instant blank slate for custom layouts.
|
Getting Started
To use SiticoneEmptyForm, simply modify your Form class to inherit from it instead of the standard library Form.
using SiticoneNetFrameworkUI;
// Standard WinForms inheritance:
// public partial class MainForm : Form
// Updated Siticone inheritance:
public partial class MainForm : SiticoneEmptyForm
{
public MainForm()
{
InitializeComponent();
// The form is now borderless, double-buffered,
// and features a native drop shadow automatically.
this.StartPosition = FormStartPosition.CenterScreen;
this.Size = new Size(800, 600);
}
}
Public Properties
As a subclass of Form, all standard Form properties are available. The following properties are pre-configured or specifically relevant to borderless design.
| Property | Type | Description & Usage |
|---|---|---|
DoubleBuffered |
bool | this.DoubleBuffered = true; Enabled by default in the constructor. Essential for smooth rendering of custom UI elements. |
BackColor |
Color |
this.BackColor = Color.White;
Sets the primary canvas color. Can be set to specific colors for theming or Color.Transparent for shaped windows.
|
FormBorderStyle |
FormBorderStyle | this.FormBorderStyle = FormBorderStyle.None; Set to None by default. Changing this will restore standard OS chrome (caption bars), disabling the "Empty Form" appearance. |
TransparencyKey |
Color | this.TransparencyKey = Color.Magenta; Allows for creating "holes" in the form. Pixels matching this color will be fully transparent and click-through. |
Common Implementation Patterns
Since SiticoneEmptyForm removes the standard title bar, developers often need to reimplement basic window behaviors like dragging and shaping. Below are standard patterns for achieving this.
1. Implementing Window Dragging
Because the native caption bar is removed, users cannot move the window by default. You can use standard Windows messages to restore this functionality on a custom panel or the form itself.
// Standard Win32 constants for window dragging
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
// Attach this event handler to your custom TitleBar Panel or the Form itself
private void TitleBar_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
2. Creating Rounded Forms
To create a rounded window appearance, you can manipulate the Form's Region. The SiticoneEmptyForm shadow engine automatically adapts to these custom regions.
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn(
int nLeftRect, int nTopRect,
int nRightRect, int nBottomRect,
int nWidthEllipse, int nHeightEllipse
);
public MyRoundedForm()
{
InitializeComponent();
// Define a region with 20px rounded corners
this.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
}
System Compatibility
The SiticoneEmptyForm includes an intelligent internal engine that detects the host Operating System to ensure consistent rendering across different environments.
| Environment | Behavior |
|---|---|
Modern Windows (10/11) |
Uses native desktop composition to render high-quality, hardware-accelerated shadows that match the system theme. |
Legacy Windows (7/8) |
Automatically falls back to legacy class styles to ensure a drop shadow is still visible, maintaining depth even on older platforms without desktop composition. |