)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the backcolor and forecolor of WinForms MessageBoxAdv Buttons?

Platform: WinForms |
Control: MessageBoxAdv |
Published Date: January 31, 2018 |
Last Revised Date: January 6, 2020

Customize the backcolor and forecolor

The MessageBoxAdv contains below listed buttons Combination.

  1. OK.
  2. OK Cancel.
  3. Yes No.
  4. Yes No Cancel.
  5. Abort Retry Ignore.
  6. 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

Customize the backcolor and forecolor of MessageBoxAdv

Samples:

C#:  MessageBoxAdvSample

VB:  MessageBoxAdvExample

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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon