Export (0) Print
Expand All

Creating Message Boxes for Bi-Directional Windows Applications

By default, a message box appears 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 makes sure that wrapped text is aligned properly.)
    Note   The captions of buttons on the message box (such as "OK") are established by the Windows system locale, and you cannot set these during the call.

    The following 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);
    

See Also

Globalizing Windows Forms | Localizing Applications | Creating Mirrored Windows Forms and Controls | Bi-directional Support for Windows Applications

Show:
© 2014 Microsoft