How to customize the appearance of the ControlBox buttons in WinForms MetroForm?
Customize the control box appearance
In WinForms MetroForm at present, there is no option to customize ControlBox button bounds, and appearance cannot be customized. If user would like to customize the ControlBox, that can be achieved by using property named CaptionImages and by handling below events.
ImageMouseMove - This event is raised when the mouse pointer enters CaptionImage bounds and used to display the ToolTip for Control Box buttons.
ImageMouseUp - This event raises when Mouse pointer selection is done on CaptionImage bounds and Mouse selection is released.
ImageMouseEnter - This event is raised when Mouse pointer enters CaptionImage bounds. It is used to show highlight effect for CaptionImage back color.
ImageMouseLeave - This event is raised when Mouse pointer leaves CaptionImage bounds. It is used to show highlight effect for CaptionImage back color.
C#
//To Set Properties for the CaptionImages
captionImage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
captionImage1.Image = global::Metroform.Properties.Resources.Close;
captionImage1.Location = new System.Drawing.Point(760, 4);
captionImage1.Name = "CaptionImage1";
captionImage2.BackColor = System.Drawing.Color.Transparent;
captionImage2.Image = global::Metroform.Properties.Resources.max;
captionImage2.Location = new System.Drawing.Point(730, 4);
captionImage2.Name = "CaptionImage2";
captionImage3.BackColor = System.Drawing.Color.Transparent;
captionImage3.Image = global::Metroform.Properties.Resources.Minus;
captionImage3.Location = new System.Drawing.Point(703, 4);
captionImage3.Name = "CaptionImage3";
//To add Caption Images into the MetroForm
this.CaptionImages.Add(captionImage1);
this.CaptionImages.Add(captionImage2);
this.CaptionImages.Add(captionImage3);
VB
'To Set Properties for the CaptionImages
captionImage1.BackColor = System.Drawing.Color.FromArgb((CInt(Fix((CByte(192))))), (CInt(Fix((CByte(0))))), (CInt(Fix((CByte(0))))))
captionImage1.Image = My.Resources.Close
captionImage1.Location = New System.Drawing.Point(760, 4)
captionImage1.Name = "CaptionImage1"
captionImage2.BackColor = System.Drawing.Color.Transparent
captionImage2.Image = My.Resources.max
captionImage2.Location = New System.Drawing.Point(730, 4)
captionImage2.Name = "CaptionImage2"
captionImage3.BackColor = System.Drawing.Color.Transparent
captionImage3.Image = My.Resources.Minus
captionImage3.Location = New System.Drawing.Point(703, 4)
captionImage3.Name = "CaptionImage3"
'To add Caption Images into the MetroForm
Me.CaptionImages.Add(captionImage1)
Me.CaptionImages.Add(captionImage2)
Me.CaptionImages.Add(captionImage3)
Me.MaximizeBox = False
Me.MinimizeBox = False
Figure 1. Customize the ControlBox appearance in MetroForm with image.
Samples:
C#: Customize the ControlBox buttons appearance
VB: Customize the ControlBox buttons appearance
Reference Link: Customization in MetroForm