Skip to main content

XtraMessageBox.SmartTextWrap Property

Gets or sets whether the message box width is restricted based on the available working area, and the text is automatically wrapped. This is a static property.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public static bool SmartTextWrap { get; set; }

Property Value

Type Description
Boolean

true if the message box width is restricted based on the available working area, and the text is automatically wrapped; otherwise, false. The default is false.

Remarks

When using the XtraMessageBox, to start a new line in the text, you can use the Environment.NewLine property which contains the newline string constant specific to the current platform. See the example below.

XtraMessageBox.Show("Changes have been made in the form." + Environment.NewLine + "Save changes?", "XtraMessageBox", MessageBoxButtons.YesNoCancel);

Also, you can use language-specific newline support such as the escape characters ‘\r’ and ‘\n’ in Microsoft C# and C/C++, or vbCrLf in Microsoft Visual Basic.

However, in some cases, you may need to display a long message which cannot be previously formatted. By default, the message box width depends on the longest line in the text that it displays. When displaying a long text, this may result in message boxes that are too wide. Set the SmartTextWrap property to true to restrict the message box width based on the text length and the available working area, and automatically wrap the text. When this setting is enabled, the form width is set to the least of the following values, sufficient to display the message in its entirety:

  • 278 DLU (dialog units);
  • 5/8 of the working area width;
  • 6/8 of the working area width;
  • 7/8 of the working area width.

Note

The SmartTextWrap property is not in effect if the text is formatted using HTML tags (see XtraMessageBox.AllowHtmlText).

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SmartTextWrap property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also