Loading...
Loading...
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.
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-formSfFormSfFormSfFormMetroFormOffice2007FormSyncfusion.Core.WinForms.dllSyncfusion.Shared.Base.dllusing 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;
}
}
}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 Class// 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);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);
}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;
}// 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();
}
}// 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";
}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();
}StyleTitleBarTextControlAllowRoundedCornersThemeNameIsMdiContainerHeightBackColorForeColorTextHorizontalAlignmentTextVerticalAlignmentIconHorizontalAlignmentIconVerticalAlignmentAllowRichTextCloseButtonForeColorMinimizeButtonForeColorMaximizeButtonForeColorCloseButtonHoverBackColorCloseButtonPressedBackColorCloseButtonImageCloseButtonHoverImageCloseButtonPressedImageBorderInactiveBorderShadowOpacityInactiveShadowOpacityTitleBarTextControl| 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 |
SfFormMetroFormOffice2007FormSuspendLayout()ResumeLayout()IsMdiContainer = trueActiveMdiChildProgram.csVisibletrueProgram.csThemeNameInitializeComponent()IsMdiContainer = trueMdiParent.Show().ShowDialog()FormBorderStyleNoneBorder