Back to Devexpress

XtraMessageBoxArgs.ImageOptions Property

windowsforms-devexpress-dot-xtraeditors-dot-xtramessageboxargs-dab729f6.md

latest4.2 KB
Original Source

XtraMessageBoxArgs.ImageOptions Property

Gets image-related properties of an XtraMessageBox.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public MessageBoxImageOptions ImageOptions { get; }
vb
Public ReadOnly Property ImageOptions As MessageBoxImageOptions

Property Value

TypeDescription
DevExpress.XtraEditors.MessageBoxImageOptions

Image-related properties.

|

Remarks

The following table lists available settings:

|

Property

|

Description

| | --- | --- | |

Image

|

Gets or sets the raster image displayed in the message body.

| |

SvgImage

|

Gets or sets the vector image displayed in the message body.

| |

SvgImageSize

|

Gets or sets vector image size.

| |

ImageUri

|

Gets or sets the uniform resource identifier that specifies a context-dependent image from the Image Gallery.

| |

Icon

|

Gets or sets the icon displayed in the message body.

| |

MessageBoxIcon

|

Gets or sets the MessageBoxIcon displayed in the message body.

| |

SvgImageColorizationMode

|

Gets or sets how to adjust icon colors according to the active application skin.

|

The following example displays a vector image from an SvgImageCollection in the message box.

Note

svgImageCollection1 is created and populated at design time.

csharp
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
  // Create and initialize an object with message box settings.
  XtraMessageBoxArgs args = new XtraMessageBoxArgs() {
    Caption = "Warning",
    Text = "Do you want to quit?",
    Buttons = new DialogResult[] { DialogResult.Yes, DialogResult.No }
    };
  // Assign a message box icon.
  args.ImageOptions.SvgImage = svgImageCollection1[0];
  args.ImageOptions.SvgImageSize = new Size(24, 24);
  // Display the message box and close the application if the user clicks "Yes".
  if (XtraMessageBox.Show(args) == DialogResult.No)
    e.Cancel = true;
}
vb
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
  ' Create and initialize an object with message box settings.
  Dim args As New XtraMessageBoxArgs() With {
    .Caption = "Warning",
    .Text = "Do you want to quit?",
    .Buttons = New DialogResult() { DialogResult.Yes, DialogResult.No }
  }
  ' Assign a message box icon.
  args.ImageOptions.SvgImage = svgImageCollection1(0)
  args.ImageOptions.SvgImageSize = New Size(24, 24)
  ' Display the message box and close the application if the user clicks "Yes".
  If XtraMessageBox.Show(args) = DialogResult.No Then
    e.Cancel = True
  End If
End Sub

See Also

XtraMessageBox

XtraMessageBoxArgs Class

XtraMessageBoxArgs Members

DevExpress.XtraEditors Namespace