Implement and configure Syncfusion MessageBoxAdv control in Windows Forms - an enhanced message box with themes, custom icons, details view, and localization support. Use when displaying modal messages, confirmations, errors, warnings, or information dialogs. Covers Office themes, message box appearance customization, multilanguage dialogs, and replacing standard MessageBox with styled alternatives.
An advanced message box control for Windows Forms that provides themed dialogs, custom icons, expandable details, localization support, and complete appearance customization.
Use this skill when you need to:
The MessageBoxAdv is an enhanced replacement for the standard Windows Forms MessageBox that provides:
Show() method pattern (no instantiation needed)ILocalizationProviderKey Capabilities:
MessageBoxAdv.Show() static method for displaying dialogsDialogResult return value for capturing user responseMessageBoxStyle property for theme selectionMetroColorTable for Metro theme customizationCanResize property for runtime size adjustmentReturn Values:
MessageBoxAdv returns DialogResult enum values: OK, Cancel, Yes, No, Retry, Abort, Ignore, None
📄 Read: references/getting-started.md
When to read: Starting new implementation, setting up dependencies, first-time usage, basic Show() method
Topics covered:
📄 Read: references/button-parameters.md
When to read: Configuring button combinations, adding icons, enabling features (RTL, details, resizing)
Topics covered:
📄 Read: references/visual-styles.md
When to read: Applying themes, matching application style, using Office color schemes
Topics covered:
When to read: Customizing Metro theme colors, branding message boxes, matching corporate colors
Topics covered:
📄 Read: references/localization.md
When to read: Implementing multilanguage applications, localizing button text, international deployments
Topics covered:
C#:
using Syncfusion.Windows.Forms;
// Set Metro theme globally
MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Metro;
// Display simple message box
MessageBoxAdv.Show(this, "File saved successfully!", "Success",
MessageBoxButtons.OK, MessageBoxIcon.Information);
// Confirmation dialog with Yes/No
DialogResult result = MessageBoxAdv.Show(this, "Save changes?", "File Modified",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
// Save changes
}
VB.NET:
Imports Syncfusion.Windows.Forms
' Set Metro theme globally
MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Metro
' Display simple message box
MessageBoxAdv.Show(Me, "File saved successfully!", "Success", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
' Confirmation dialog with Yes/No
Dim result As DialogResult = MessageBoxAdv.Show(Me, "Save changes?", "File Modified", _
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = DialogResult.Yes Then
' Save changes
End If
Scenario: Prompt user to save changes before closing
C#:
using Syncfusion.Windows.Forms;
// Set Office2016 Colorful theme
MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Office2016;
MessageBoxAdv.Office2016Theme = Office2016Theme.Colorful;
// Show confirmation with YesNoCancel
DialogResult result = MessageBoxAdv.Show(
this,
"Do you want to save changes to Document1.txt?",
"Unsaved Changes",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question
);
switch (result)
{
case DialogResult.Yes:
SaveDocument();
CloseDocument();
break;
case DialogResult.No:
CloseDocument();
break;
case DialogResult.Cancel:
// Do nothing, stay in editor
break;
}
Scenario: Display error with detailed stack trace or log information
C#:
using Syncfusion.Windows.Forms;
using System.Drawing;
// Load custom error icon
Image customIcon = Image.FromFile("error_icon.png");
// Set theme
MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Metro;
// Show with details view
MessageBoxAdv.Show(
this,
"Failed to connect to database server.",
"Connection Error",
MessageBoxButtons.RetryCancel,
customIcon,
new Size(48, 48),
"Error Details:\n" +
"Server: db.company.com\n" +
"Port: 1433\n" +
"Timeout: Connection timeout after 30 seconds\n" +
"Stack Trace: at System.Data.SqlClient.SqlConnection.Open()"
);
Scenario: Display message box with German button text and messages
C#:
using Syncfusion.Windows.Forms;
using System.Globalization;
// Implement custom localizer
public class GermanLocalizer : ILocalizationProvider
{
public string GetLocalizedString(CultureInfo culture, string name, object obj)
{
switch (name)
{
case ResourceIdentifiers.Yes:
return "Ja";
case ResourceIdentifiers.No:
return "Nein";
case ResourceIdentifiers.OK:
return "OK";
case ResourceIdentifiers.Cancel:
return "Abbrechen";
case ResourceIdentifiers.Retry:
return "Wiederholen";
case ResourceIdentifiers.Abort:
return "Abbrechen";
case ResourceIdentifiers.Ignore:
return "Ignorieren";
case ResourceIdentifiers.Details:
return "Details";
default:
return string.Empty;
}
}
}
// Initialize localizer before showing message box
LocalizationProvider.Provider = new GermanLocalizer();
// Show localized message box
MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Office2013;
MessageBoxAdv.Office2013Theme = Office2013Theme.White;
MessageBoxAdv.Show(
this,
"Möchten Sie die Änderungen speichern?",
"Datei geändert",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question
);
| Property | Type | Description |
|---|---|---|
MessageBoxStyle | MessageBoxAdv.Style | Sets theme: Default, Office2007, Office2010, Metro, Office2013, Office2016 |
Office2007Theme | Office2007Theme | Color scheme for Office2007: Black, Blue, Silver, Managed |
Office2010Theme | Office2010Theme | Color scheme for Office2010: Black, Blue, Silver, Managed |
Office2013Theme | Office2013Theme | Color scheme for Office2013: DarkGray, LightGray, White |
Office2016Theme | Office2016Theme | Color scheme for Office2016: Colorful, White, DarkGray |
MetroColorTable | MessageBoxAdvMetroColorTable | Metro theme color customization |
RightToLeft | RightToLeft | Enable RTL layout: Yes, No |
CanResize | bool | Enable runtime resizing with gripper |
| Parameter | Type | Description |
|---|---|---|
owner | IWin32Window | Parent window (typically this or form instance) |
text | string | Message text to display |
caption | string | Title bar text |
buttons | MessageBoxButtons | Button combination: OK, OKCancel, YesNo, YesNoCancel, RetryCancel, AbortRetryIgnore |
icon | MessageBoxIcon | Built-in icon: Asterisk, Error, Exclamation, Hand, Information, None, Question, Stop, Warning |
icon | Image | Custom icon image |
iconSize | Size | Custom icon size (width, height) |
details | string | Expandable detail text (shows "Details" button) |
Type: DialogResult
Values: OK, Cancel, Yes, No, Retry, Abort, Ignore, None
User tries to close application with unsaved work:
DialogResult result = MessageBoxAdv.Show(this,
"You have unsaved changes. Exit anyway?",
"Confirm Exit",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
Application.Exit();
}
Display error with retry option:
DialogResult result = MessageBoxAdv.Show(this,
"File is locked by another process.",
"File Access Error",
MessageBoxButtons.RetryCancel,
MessageBoxIcon.Error);
if (result == DialogResult.Retry)
{
AttemptFileAccess();
}
Simple notification without choices:
MessageBoxAdv.Show(this,
"Backup completed successfully!",
"Backup Complete",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
Confirm destructive action:
DialogResult result = MessageBoxAdv.Show(this,
"Are you sure you want to delete this record? This cannot be undone.",
"Confirm Delete",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation);
if (result == DialogResult.Yes)
{
DeleteRecord();
}
Match message box to corporate branding:
MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Metro;
MessageBoxAdv.MetroColorTable.CaptionBarColor = Color.FromArgb(0, 120, 215); // Corporate blue
MessageBoxAdv.MetroColorTable.YesButtonBackColor = Color.FromArgb(0, 120, 215);
MessageBoxAdv.MetroColorTable.NoButtonBackColor = Color.FromArgb(82, 82, 82);
MessageBoxAdv.Show(this,
"Upload to cloud storage?",
"Company Portal",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
Assembly: Syncfusion.Shared.Base.dll
Namespace: Syncfusion.Windows.Forms
NuGet Package: Syncfusion.Shared.Base
Minimum .NET Framework: 4.5
Key Classes:
MessageBoxAdv - Main static class for showing message boxesMessageBoxAdvMetroColorTable - Metro theme color customizationILocalizationProvider - Interface for localizationLocalizationProvider - Localization provider registrationResourceIdentifiers - Resource string constants for localizationRelated Skills: