Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Create Message Boxes for Bi-Directional Windows Forms

By default, a message box appears to users with left-to-right reading order. You can create messages boxes with right-to-left reading order and mirroring by passing certain parameters when you display the message box.

To create bi-directional message boxes

  • Call the MessageBox class's Show method, and in the options parameter, pass the logical OR combination of the RtlReading and RightAlign members of the MessageBoxOptions enumeration.

    The RightAlign member ensures that wrapped text is aligned properly.

    Note Note

    The captions of buttons on the message box, such as OK, are established by the Windows operating system locale, and you cannot set these during the call.

    The following code example shows how to display a message box with right-to-left reading order and mirroring:

    ' Visual Basic
    MessageBox.Show("Text", "Caption", _
       MessageBoxButtons.OK, MessageBoxIcon.Question, _
       MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading _
          Or MessageBoxOptions.RightAlign)
    
    // C#
    MessageBox.Show("Text", "Caption", 
        MessageBoxButtons.OK, MessageBoxIcon.Question,
        MessageBoxDefaultButton.Button1, 
        MessageBoxOptions.RtlReading
        | MessageBoxOptions.RightAlign);
    
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.