Skip to content

Latest commit

 

History

History
120 lines (82 loc) · 4.82 KB

File metadata and controls

120 lines (82 loc) · 4.82 KB
layout post
title Form Customization in Windows Forms Form control | Syncfusion®
description Learn about Form Customization support in Syncfusion® Windows Forms Form (SfForm) control and more details.
platform WindowsForms
control SfForm
documentation ug

Form Customization in Windows Forms Form (SfForm)

Form icon

A form icon designates the picture that represents the form in the taskbar as well as the icon displayed on the title bar of the form.

Changing form icon

The form icon displayed on the title bar and task bar can be changed by using the Icon property.

{% tabs %} {% highlight c# %} this.Icon = new Icon("sfIcon.ico"); {% endhighlight %} {% highlight vb %} Me.Icon = New Icon("sfIcon.ico") {% endhighlight %} {% endtabs %}

WindowsForms Form shows icon

Form icon alignment

The form icon can be aligned vertically and horizontally by using the Style.TitleBar.IconVerticalAlignment and Style.TitleBar.IconHorizontalAlignment properties.

{% tabs %} {% highlight c# %} this.Style.TitleBar.IconVerticalAlignment = VerticalAlignment.Top; this.Style.TitleBar.IconHorizontalAlignment = HorizontalAlignment.Right; {% endhighlight %} {% highlight vb %} Me.Style.TitleBar.IconVerticalAlignment = VerticalAlignment.Top Me.Style.TitleBar.IconHorizontalAlignment = HorizontalAlignment.Right {% endhighlight %} {% endtabs %}

WindowsForms Form icon is alignment

Form border

Appearance of the border can be customized by using the Style.Border and Style.InactiveBorder properties.

{% tabs %} {% highlight c# %} //Customize active state border appearance this.Style.Border = new Pen(Color.SkyBlue, 2);

//Customize inactive state border appearance this.Style.InactiveBorder = new Pen(Color.LightGray, 2); {% endhighlight %} {% highlight vb %} 'Customize active state border appearance Me.Style.Border = New Pen(Color.SkyBlue, 2)

'Customize inactive state border appearance Me.Style.InactiveBorder = New Pen(Color.LightGray, 2) {% endhighlight %} {% endtabs %}

WindowsForms Form with customized border color

Shadow effect

Shadow effect of the form can be customized by using the Style.ShadowOpacity and Style.InactiveShadowOpacity properties.

{% tabs %} {% highlight c# %} //Customize the shadow for active state this.Style.ShadowOpacity = 255;

//Customize the shadow for inactive state this.Style.InactiveShadowOpacity = 100; {% endhighlight %} {% highlight vb %} 'Customize the shadow for active state Me.Style.ShadowOpacity = 255

'Customize the shadow for inactive state Me.Style.InactiveShadowOpacity = 100 {% endhighlight %} {% endtabs %}

WindowsForms Form with shadow effect

N> Shadow can be disabled by setting the ShadowOpacity property as zero.

Rounded corner

Rounded corners for SfForm can be enabled by using the AllowRoundedCorners property. Rounded corners are not supported in OS versions lower than Windows 11. Enabling AllowRoundedCorners property will have no effect on those operating systems.

N> When the rounded corners are enabled, the border and shadow of the Form are drawn by the operating system.

{% tabs %}

{% highlight C# %}

this.AllowRoundedCorners = true;

{% endhighlight %}

{% highlight VB %}

Me.AllowRoundedCorners = true

{% endhighlight %}

{% endtabs %}

WindowsForms Form with rounded corners