How to hide icons in the WinForms MetroForm caption?
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 WinForms 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: Customization in MetroForm
Conclusion
I hope you enjoyed learning about how to hide icons in the MetroForm caption.
You can refer to our WinForms MetroForm feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms MetroForm documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!