Category / Section
How to hide icons in the WinForms MetroForm caption?
1 min read
Hide the form icon
You can hide the form icon from your application without hiding the icon in the Taskbar by using the CaptionImages support in MetroForm. Follow the given steps to achieve this.
- Create a caption image based on the MetroForm caption color.
- Add it to the caption images collection and specify its location as it overlaps the MetroForm icon.
C#
//Sets the borderColor. this.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218))))); //Sets the CaptionBarColor. this.CaptionBarColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218))))); //Sets the CaptionButton color. this.CaptionButtonColor = System.Drawing.Color.White; //Sets the Caption Forecolor. this.CaptionForeColor = System.Drawing.Color.White; //Sets the BackColor of the Caption Image. captionImage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218))))); //Sets the caption image location. captionImage1.Location = new System.Drawing.Point(0, 0); //Caption image name. captionImage1.Name = "CaptionImage1"; //Specifies the caption image size. captionImage1.Size = new System.Drawing.Size(30, 30); //Adds the CaptionImage to its collection. this.CaptionImages.Add(captionImage1);
VB
'Sets the borderColor. Me.BorderColor = System.Drawing.Color.FromArgb((CInt(Fix((CByte(17))))), (CInt(Fix((CByte(158))))), (CInt(Fix((CByte(218)))))) 'Sets the CaptionBarColor. Me.CaptionBarColor = System.Drawing.Color.FromArgb((CInt(Fix((CByte(17))))), (CInt(Fix((CByte(158))))), (CInt(Fix((CByte(218)))))) 'Sets the CaptionButton color. Me.CaptionButtonColor = System.Drawing.Color.White 'Sets the caption Forecolor. Me.CaptionForeColor = System.Drawing.Color.White 'Sets the BackColor of the Caption Image. captionImage1.BackColor = System.Drawing.Color.FromArgb((CInt(Fix((CByte(17))))), (CInt(Fix((CByte(158))))), (CInt(Fix((CByte(218)))))) 'Sets the caption image location. captionImage1.Location = New System.Drawing.Point(0, 0) 'Caption image name. captionImage1.Name = "CaptionImage1" 'Specifies the caption image size. captionImage1.Size = New System.Drawing.Size(30, 30) 'Adds the CaptionImage to its collection. Me.CaptionImages.Add(captionImage1)
Figure 1: Form Icon hidden in Application
Samples:
Reference link: https://help.syncfusion.com/windowsforms/metro-form/customization