Category / Section
How to customize the appearance of the WinForms MessageBoxAdv?
1 min read
Appearance of MessageBoxAdv
The appearance of the MessageBoxAdv can be customized by using the following properties of the MetroStyleColorTable.
- AbortButtonBackColor
- CancelButtonBackColor
- IgnoreButtonBackColor
- NoButtonBackColor
- OKButtonBackColor
- RetryButtonBackColor
- YesButtonBackColor
- CaptionBarColor
- CaptionForeColor
- ForeColor
- BackColor
- BorderColor
The following code example demonstrates the same.
C#
//MetroColor table for MessageBoxAdv MetroStyleColorTable metroColorTable = new MetroStyleColorTable(); //Sets the NoButton backColor metroColorTable.NoButtonBackColor = Color.Red; //Sets the YesButton backColor metroColorTable.YesButtonBackColor = Color.SkyBlue; //Sets the OK button backcolor metroColorTable.OKButtonBackColor = Color.Green; //Applies the MetroStyleColorTable to MessageBoxAdv MessageBoxAdv.MetroColorTable = metroColorTable; //Sets the MessageBoxStyle as Metro MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Metro;
VB
'MetroColor table for MessageBoxAdv Dim metroColorTable As New MetroStyleColorTable() 'Sets the NoButton backColor metroColorTable.NoButtonBackColor = Color.Red 'Sets the YesButton backColor metroColorTable.YesButtonBackColor = Color.SkyBlue 'Sets the OK button backcolor metroColorTable.OKButtonBackColor = Color.Green 'Applies the MetroStyleColorTable to MessageBoxAdv MessageBoxAdv.MetroColorTable = metroColorTable 'Sets the MessageBoxStyle as Metro MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Metro
Screenshot
Figure 1: Metro Style appearance of the MessageBoxAdv
Samples:
Reference link: https://help.syncfusion.com/windowsforms/messagebox/styles-settings