Category / Section
How to customize multiple WinForms MetroForm loaded in application?
1 min read
Customize multiple MetroForm loaded in application
In an Application, user will have multiple number of MetroForm and it will be difficult for users, to do the modifications in each of the MetroForm used in it. Hence user can create Custom Form inherited from MetroForm and use it in Forms loaded in application. This will help user to perform modifications in one place and make changes reflected in all of the used MetroForm.
Following code examples demonstrates the same.
C#
/// <summary> /// Class that inherits the properties of MetroForm /// </summary> public class MetroFormAdv : MetroForm { public MetroFormAdv() { } InitializeComponent(); //Properties of MetroForm this.CaptionBarColor = Color.FromArgb(17, 158, 218); this.CaptionBarHeight = 26; this.CaptionAlign = HorizontalAlignment.Left; this.CaptionFont = new Font("Times New Roman", 12, FontStyle.Italic); this.StartPosition = FormStartPosition.CenterScreen; }
VB
''' <summary> ''' Class that inherits the properties of MetroForm ''' </summary> Public Class MetroFormAdv Inherits MetroForm Public Sub New() InitializeComponent() 'Properties of MetroForm Me.CaptionBarColor = Color.FromArgb(17, 158, 218) Me.CaptionBarHeight = 26 Me.CaptionAlign = HorizontalAlignment.Left Me.CaptionFont = New Font("Times New Roman", 12, FontStyle.Italic) Me.StartPosition = FormStartPosition.CenterScreen End Sub
Figure 1. customize multiple MetroForm loaded in application with image
Samples:
C#: How to customize multiple MetroForm loaded in application easily?
VB: How to customize multiple MetroForm loaded in application easily?