syncfusion-winforms-form
Original:🇺🇸 English
Translated
Implements Syncfusion SfForm control for Windows Forms with advanced customization features including custom title bars, MDI support, and modern appearance options. Use this when working with customizable window forms, title bar customization, MDI parent-child relationships, or form theming. The skill covers user controls in title bars, form borders, shadow effects, rounded corners, and complete appearance control.
48installs
Added on
NPX Install
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-formTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Implementing Windows Forms (SfForm)
The Syncfusion is an advanced window control for Windows Forms applications that provides complete customization of form appearance, custom user interface in the title bar, and comprehensive MDI (Multiple Document Interface) support.
SfFormWhen to Use This Skill
Use when you need to:
SfForm- Customize title bar appearance - Colors, text alignment, button styles, custom icons
- Load custom controls in title bar - Add search boxes, navigation controls, or any user control
- Build MDI applications - Parent forms with multiple child windows
- Apply professional themes - Built-in Office 2016/2019 and high contrast themes
- Customize form borders - Active/inactive states, colors, thickness, rounded corners
- Add shadow effects - Customizable shadow opacity for modern appearance
- Support rich text in title bar - Display formatted text in form title
- Localize form elements - Multi-language support for global applications
SfForm vs MetroForm vs Office2007Form:
- Use for modern applications requiring custom title bar controls and full appearance control
SfForm - Use if you only need caption images and labels with built-in skins
MetroForm - Use for Microsoft Office 2007-style UI with built-in color schemes
Office2007Form
Key Features
- Title Bar Customization - Height, colors, text alignment, button customization
- User Control Loading - Place any WinForms control in the title bar
- MDI Support - Complete parent-child form management
- Border Customization - Active/inactive border colors and thickness
- Theme Support - 6 built-in professional themes
- Rich Text Support - RTF formatting in title bar text
- Shadow Effects - Adjustable shadow opacity
- Rounded Corners - Windows 11 style rounded corners
- Localization - Full resource file support
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Assembly deployment and dependencies
- Converting standard Form to SfForm
- Basic setup and initialization
- Initial customization examples
- Loading user controls to title bar
Title Bar Customization
📄 Read: references/titlebar-customization.md
- Adjusting title bar height
- Text alignment (horizontal and vertical)
- Customizing title bar buttons (icons, colors, states)
- Hiding buttons (minimize, maximize, close)
- Rich text formatting in title bar
- Loading user controls to title bar
- Icon and caption customization
Form Customization
📄 Read: references/form-customization.md
- Setting and aligning form icons
- Border customization (active/inactive states)
- Shadow effect configuration
- Shadow opacity settings
- Rounded corners (Windows 11+)
MDI Customization
📄 Read: references/mdi-customization.md
- Creating MDI parent forms
- Adding MDI child forms
- Customizing child form appearance
- Getting active MDI child
- Key event handling in MDI children
Theming
📄 Read: references/theming.md
- Loading theme assemblies
- Applying themes to forms
- Available themes (Office2016/2019, HighContrast)
- Theme customization options
Localization
📄 Read: references/localization.md
- Creating resource files for localization
- Setting culture and UI culture
- Localizing at sample level
- Editing default resource files
- Different assembly/namespace configurations
Quick Start
Step 1: Add Assembly References
Add the following references to your project:
Syncfusion.Core.WinForms.dllSyncfusion.Shared.Base.dll
Step 2: Convert Form to SfForm
csharp
using Syncfusion.WinForms.Controls;
namespace MyApplication
{
public partial class Form1 : SfForm // Change from Form to SfForm
{
public Form1()
{
InitializeComponent();
// Basic customization
this.Style.TitleBar.BackColor = Color.FromArgb(46, 46, 46);
this.Style.TitleBar.ForeColor = Color.White;
}
}
}VB.NET:
vb
Imports Syncfusion.WinForms.Controls
Public Class Form1
Inherits SfForm ' Change from Form to SfForm
Public Sub New()
InitializeComponent()
' Basic customization
Me.Style.TitleBar.BackColor = Color.FromArgb(46, 46, 46)
Me.Style.TitleBar.ForeColor = Color.White
End Sub
End ClassStep 3: Customize Appearance
csharp
// Title bar button colors
this.Style.TitleBar.CloseButtonForeColor = Color.White;
this.Style.TitleBar.MinimizeButtonForeColor = Color.White;
this.Style.TitleBar.MaximizeButtonForeColor = Color.White;
// Button hover colors
this.Style.TitleBar.CloseButtonHoverBackColor = Color.Red;
this.Style.TitleBar.MinimizeButtonHoverBackColor = Color.DarkGray;
this.Style.TitleBar.MaximizeButtonHoverBackColor = Color.DarkGray;
// Form border
this.Style.Border = new Pen(Color.FromArgb(0, 122, 204), 2);
this.Style.InactiveBorder = new Pen(Color.Gray, 2);Common Patterns
Pattern 1: Dark Theme Form
csharp
public Form1()
{
InitializeComponent();
// Dark title bar
this.Style.TitleBar.BackColor = Color.FromArgb(30, 30, 30);
this.Style.TitleBar.ForeColor = Color.White;
this.Style.TitleBar.Height = 35;
// Button styling
this.Style.TitleBar.CloseButtonForeColor = Color.White;
this.Style.TitleBar.CloseButtonHoverBackColor = Color.FromArgb(232, 17, 35);
this.Style.TitleBar.MinimizeButtonForeColor = Color.White;
this.Style.TitleBar.MaximizeButtonForeColor = Color.White;
// Border and shadow
this.Style.Border = new Pen(Color.FromArgb(0, 122, 204), 2);
this.Style.ShadowOpacity = 150;
// Client area
this.Style.BackColor = Color.FromArgb(45, 45, 48);
}Pattern 2: Custom Title Bar with Search Control
csharp
public Form1()
{
InitializeComponent();
// Create search panel
FlowLayoutPanel searchPanel = new FlowLayoutPanel();
searchPanel.Size = new Size(250, 28);
searchPanel.FlowDirection = FlowDirection.LeftToRight;
// Add search label
Label searchLabel = new Label();
searchLabel.Text = "Search:";
searchLabel.ForeColor = Color.White;
searchLabel.AutoSize = true;
searchLabel.Margin = new Padding(5, 5, 5, 0);
// Add search textbox
TextBox searchBox = new TextBox();
searchBox.Width = 180;
searchBox.Margin = new Padding(5, 2, 0, 0);
searchPanel.Controls.Add(searchLabel);
searchPanel.Controls.Add(searchBox);
// Load to title bar
this.TitleBarTextControl = searchPanel;
// Style title bar
this.Style.TitleBar.BackColor = Color.FromArgb(0, 120, 215);
this.Style.TitleBar.Height = 35;
}Pattern 3: MDI Parent with Child Forms
csharp
// Parent Form
public class MainForm : SfForm
{
public MainForm()
{
InitializeComponent();
// Enable MDI container
this.IsMdiContainer = true;
// Customize parent appearance
this.Style.TitleBar.BackColor = Color.FromArgb(0, 122, 204);
this.Style.TitleBar.ForeColor = Color.White;
}
private void CreateChildForm()
{
// Create child form
SfForm childForm = new SfForm();
childForm.Text = "Child Window 1";
childForm.MdiParent = this;
// Customize child appearance
childForm.Style.TitleBar.BackColor = Color.White;
childForm.Style.TitleBar.ForeColor = Color.Black;
childForm.Style.Border = new Pen(Color.LightGray, 1);
childForm.Show();
}
}Pattern 4: Apply Built-in Theme
csharp
// In Program.cs
static class Program
{
[STAThread]
static void Main()
{
// Register Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY");
// Load theme assemblies
SfSkinManager.LoadAssembly(typeof(Office2016Theme).Assembly);
SfSkinManager.LoadAssembly(typeof(Office2019Theme).Assembly);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
// In Form
public Form1()
{
InitializeComponent();
// Apply theme
this.ThemeName = "Office2016Colorful";
}Pattern 5: Localized Form
csharp
public Form1()
{
// Set culture before initialization
System.Threading.Thread.CurrentThread.CurrentCulture =
new System.Globalization.CultureInfo("de-DE");
System.Threading.Thread.CurrentThread.CurrentUICulture =
new System.Globalization.CultureInfo("de-DE");
InitializeComponent();
}Key Properties
Form Properties
- - Access all appearance customization options
Style - - Load custom user control to title bar
TitleBarTextControl - - Enable Windows 11 style rounded corners (bool)
AllowRoundedCorners - - Apply built-in theme (string)
ThemeName - - Enable MDI parent mode (bool)
IsMdiContainer
TitleBar Properties (Style.TitleBar)
- - Title bar height (int)
Height - - Title bar background color
BackColor - - Title bar text color
ForeColor - - Left, Center, Right
TextHorizontalAlignment - - Top, Center, Bottom
TextVerticalAlignment - - Icon horizontal position
IconHorizontalAlignment - - Icon vertical position
IconVerticalAlignment - - Enable RTF formatting (bool)
AllowRichText
Button Properties (Style.TitleBar)
- - Close button icon color
CloseButtonForeColor - - Minimize button icon color
MinimizeButtonForeColor - - Maximize button icon color
MaximizeButtonForeColor - - Close button hover background
CloseButtonHoverBackColor - - Close button pressed background
CloseButtonPressedBackColor - - Custom close button icon
CloseButtonImage - - Custom close button hover icon
CloseButtonHoverImage - - Custom close button pressed icon
CloseButtonPressedImage
Border and Shadow Properties (Style)
- - Active state border (Pen)
Border - - Inactive state border (Pen)
InactiveBorder - - Active shadow opacity (0-255)
ShadowOpacity - - Inactive shadow opacity (0-255)
InactiveShadowOpacity
Common Use Cases
Use Case 1: Modern Application with Custom Title Bar
Scenario: Building a modern desktop application with branding in the title bar
Solution: Use to load a panel with logo and navigation controls
Reference: titlebar-customization.md
Solution: Use
TitleBarTextControlReference: titlebar-customization.md
Use Case 2: Document Editor with MDI
Scenario: Creating a text editor that supports multiple open documents
Solution: Use MDI parent form with child forms for each document
Reference: mdi-customization.md
Solution: Use MDI parent form with child forms for each document
Reference: mdi-customization.md
Use Case 3: Enterprise Application with Consistent Branding
Scenario: Apply company theme across all forms in the application
Solution: Use built-in themes or create custom theme with Style properties
Reference: theming.md
Solution: Use built-in themes or create custom theme with Style properties
Reference: theming.md
Use Case 4: Multi-language Application
Scenario: Support multiple languages for international users
Solution: Implement localization with resource files
Reference: localization.md
Solution: Implement localization with resource files
Reference: localization.md
Use Case 5: Minimalist Form Design
Scenario: Create clean, distraction-free form with minimal UI
Solution: Hide title bar buttons, use custom colors, add subtle shadow
Reference: form-customization.md
Solution: Hide title bar buttons, use custom colors, add subtle shadow
Reference: form-customization.md
Comparison with Other Form Controls
| Feature | SfForm | MetroForm | Office2007Form |
|---|---|---|---|
| Custom Title Bar Controls | ✅ Yes | ❌ No | ❌ No |
| MDI Support | ✅ Yes | ✅ Yes | ✅ Yes |
| Active/Inactive Border | ✅ Yes | ⚠️ Limited | ⚠️ Limited |
| Rich Text Title | ✅ Yes | ❌ No | ❌ No |
| Shadow Customization | ✅ Yes | ❌ No | ❌ No |
| Rounded Corners | ✅ Yes (Win11+) | ❌ No | ❌ No |
| Theme Support | ✅ 6 themes | ✅ Built-in skins | ✅ Office schemes |
| Caption Images | ✅ Yes | ✅ Yes | ✅ Yes |
Recommendation: Use for maximum flexibility and modern features. Use or only for legacy applications or specific style requirements.
SfFormMetroFormOffice2007FormTips and Best Practices
Performance
- Set all style properties in the constructor before showing the form
- Use /
SuspendLayout()when adding multiple controlsResumeLayout() - Dispose of custom images and resources properly
Design
- Keep title bar height between 30-40 pixels for optimal appearance
- Use subtle shadows (opacity 100-150) for professional look
- Ensure sufficient contrast between title bar and buttons
- Test custom title bar controls at different DPI settings
MDI Applications
- Set before creating child forms
IsMdiContainer = true - Apply consistent styling to all child forms
- Use to manage current child window
ActiveMdiChild - Consider using menu strip for window management
Theme Usage
- Load theme assemblies in before creating forms
Program.cs - Apply consistent theme across all forms in application
- Test with HighContrast theme for accessibility
- Avoid mixing themed and non-themed forms
Accessibility
- Provide sufficient color contrast for title bar text
- Support keyboard navigation for all custom controls
- Test with Windows high contrast settings
- Ensure custom title bar controls are accessible
Troubleshooting
Title bar custom control not visible:
- Ensure control size fits within title bar height
- Check control's property is
Visibletrue - Verify background colors aren't transparent
Theme not applying:
- Verify theme assembly is loaded in
Program.cs - Check theme name spelling (case-sensitive)
- Ensure is set after
ThemeNameInitializeComponent()
MDI child not displaying:
- Verify parent's
IsMdiContainer = true - Check child's is set correctly
MdiParent - Ensure child form is shown with not
.Show().ShowDialog()
Border not showing:
- Verify is not
FormBorderStyleNone - Check pen width is > 0
Border - Ensure border color contrasts with background
Related Components
- MetroForm - Alternative form with built-in Metro styling
- Office2007Form - Alternative form with Office 2007 appearance
- Ribbon - For Office-style ribbon interface in title bar area
- SfSkinManager - For applying themes globally
Additional Resources
- API Reference: SfForm Class Documentation
- Sample Applications: Check installation directory for complete examples
- Support: Syncfusion Community Forums