How to customize the backcolor and forecolor of WinForms MessageBoxAdv Buttons?
Customize the backcolor and forecolor
The WinForms MessageBoxAdv contains below listed buttons Combination.
- OK.
- OK Cancel.
- Yes No.
- Yes No Cancel.
- Abort Retry Ignore.
- Retry Cancel.
This Buttons BackColor and Fore Color can be customized using below Properties.
Properties | Usage |
OKButtonBackColor OKButtonForeColor | Used to set the Ok Button Background color Used to set the Ok Button ForeColor |
CancelButtonBackColor CancelButtonForeColor | Used to set the Cancel Button Background color Used to set the Cancel Button ForeColor |
YesButtonBackColor YesButtonForeColor | Used to set the Yes Button Background color Used to set the Yes Button ForeColor |
NoButtonBackColor NoButtonForeColor | Used to set the No Button Background color Used to set the No Button ForeColor |
AbortButtonBackColor AbortButtonForeColor | Used to set the Abort Button Background color Used to set the Abort Button ForeColor |
RetryButtonBackColor RetryButtonForeColor | Used to set the Retry Button Background color Used to set the Retry Button ForeColor |
IgnoreButtonBackColor IgnoreButtonForeColor | Used to set the Ignore Button Background color Used to set the Ignore Button ForeColor |
DetailsButtonBackColor DetailsButtonForeColor | Used to set the Details Button Background color Used to set the Details Button ForeColor |
C#
//Set the MessageBoxAdv Style as Metro
Syncfusion.Windows.Forms.MessageBoxAdv.MessageBoxStyle = Syncfusion.Windows.Forms.MessageBoxAdv.Style.Metro;
//Set Yes Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.YesButtonBackColor = Color.Cornsilk;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.YesButtonForeColor = Color.Brown;
//Set No Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.NoButtonBackColor = Color.Yellow;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.NoButtonForeColor = Color.Black;
//Set OK Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.OKButtonBackColor = Color.Yellow;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.OKButtonForeColor = Color.Brown;
//Set Cancel Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.CancelButtonBackColor = Color.Brown;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.CancelButtonForeColor = Color.Yellow;
//Set Abort Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.AbortButtonBackColor = Color.Purple;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.AbortButtonForeColor = Color.Yellow;
//Set Retry Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.RetryButtonBackColor = Color.Pink;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.RetryButtonForeColor = Color.Brown;
//Set Ignore Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.IgnoreButtonBackColor = Color.Firebrick;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.IgnoreButtonForeColor = Color.Yellow;
//Details Button Back Color and Fore Color
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.DetailsButtonBackColor = Color.Violet;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.DetailsButtonForeColor = Color.Yellow;
//Show the Message with OKCancel Button
Syncfusion.Windows.Forms.MessageBoxAdv.Show("Metro Theme Customization", "This is Syncfusion MessageBoxAdv Control", MessageBoxButtons.OKCancel);VB
'Set the MessageBoxAdv Style as Metro
Syncfusion.Windows.Forms.MessageBoxAdv.MessageBoxStyle = Syncfusion.Windows.Forms.MessageBoxAdv.Style.Metro
'Set Yes Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.YesButtonBackColor = Color.Cornsilk
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.YesButtonForeColor = Color.Brown
'Set No Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.NoButtonBackColor = Color.MistyRose
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.NoButtonForeColor = Color.Blue
'Set OK Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.OKButtonBackColor = Color.Yellow
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.OKButtonForeColor = Color.Brown
'Set Cancel Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.CancelButtonBackColor = Color.Brown
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.CancelButtonForeColor = Color.Yellow
'Set Abort Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.AbortButtonBackColor = Color.Purple
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.AbortButtonForeColor = Color.Yellow
'Set Retry Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.RetryButtonBackColor = Color.Pink
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.RetryButtonForeColor = Color.Brown
'Set Ignore Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.IgnoreButtonBackColor = Color.Firebrick
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.IgnoreButtonForeColor = Color.Yellow
'Set Details Button BackColor and ForeColor
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.DetailsButtonBackColor = Color.Violet;
Syncfusion.Windows.Forms.MessageBoxAdv.MetroColorTable.DetailsButtonForeColor = Color.Yellow
'Show the Message with OKCancel Button
Syncfusion.Windows.Forms.MessageBoxAdv.Show("Metro Theme Customization", "This is Syncfusion MessageBoxAdv Control", MessageBoxButtons.OKCancel)Screenshot

Reference link: https://help.syncfusion.com/windowsforms/messagebox/styles-settings
Conclusion
I hope you enjoyed learning about how to customize the backcolor and forecolor of WinForms MessageBoxAdv Buttons.
You can refer to our WinForms MessageBoxADV’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms MessageBoxAdv documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms 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 jQuery Chart and other jQuery components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!