Form Customization in Windows Forms Form (SfForm)

28 May 20212 minutes to read

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.

this.Icon = new Icon("sfIcon.ico");
Me.Icon = New Icon("sfIcon.ico")

SfForm 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.

this.Style.TitleBar.IconVerticalAlignment = VerticalAlignment.Top;
this.Style.TitleBar.IconHorizontalAlignment = HorizontalAlignment.Right;
Me.Style.TitleBar.IconVerticalAlignment = VerticalAlignment.Top
Me.Style.TitleBar.IconHorizontalAlignment = HorizontalAlignment.Right

Form icon is aligned in sfform

Form border

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

//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);
'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)

SfForm with customized border color

Shadow effect

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

//Customize the shadow for active state
this.Style.ShadowOpacity = 255;

//Customize the shadow for inactive state
this.Style.InactiveShadowOpacity = 100;
'Customize the shadow for active state
Me.Style.ShadowOpacity = 255

'Customize the shadow for inactive state
Me.Style.InactiveShadowOpacity = 100

SfForm with shadow effect


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