Articles in this section
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.

  1. AbortButtonBackColor
  2. CancelButtonBackColor
  3. IgnoreButtonBackColor
  4. NoButtonBackColor
  5. OKButtonBackColor
  6. RetryButtonBackColor
  7. YesButtonBackColor
  8. CaptionBarColor
  9. CaptionForeColor
  10. ForeColor
  11. BackColor
  12. 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

Metro style appearance of the MessageBoxAdv

Figure 1: Metro Style appearance of the MessageBoxAdv

Samples:

C#: https://www.syncfusion.com/downloads/support/directtrac/135929/MessageBoxAdvMetroColorTable-646548035.zip

VB: https://www.syncfusion.com/downloads/support/directtrac/137069/MessageBoxAdvMetroColorTable_VB-382674015.zip

Reference link: https://help.syncfusion.com/windowsforms/messagebox/styles-settings

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied