Skip to main content
All docs
V25.2
  • ShapeFormat.TextBox Property

    Provides access to text box content and its settings.

    Namespace: DevExpress.XtraRichEdit.API.Native

    Assembly: DevExpress.RichEdit.v25.2.Core.dll

    NuGet Package: DevExpress.RichEdit.Core

    Declaration

    TextBox TextBox { get; }

    Property Value

    Type Description
    TextBox

    An object that defines text box content and its settings.

    Remarks

    Call the ShapeCollection.InsertTextBox method to add a text box to a document. The ShapeFormat.TextBox property allows you to specify text box content and define its settings (such as margins and alignment).

    Document document = wordProcessor.Document;
    document.Unit = DevExpress.Office.DocumentUnit.Inch;
    // Create a text box.
    Shape myTextBox = document.Shapes.InsertTextBox(document.Range.Start, new RectangleF(1.5f, 1f, 1.5f, 0.5f));
    // Specify the text box background color.
    myTextBox.Fill.Color = System.Drawing.Color.WhiteSmoke;
    // Draw a border around the text box.
    myTextBox.Line.Color = System.Drawing.Color.Black;
    myTextBox.Line.Thickness = 1;
    // Modify text box content.
    SubDocument textBoxDocument = myTextBox.ShapeFormat.TextBox.Document;
    textBoxDocument.AppendText("Text box");
    CharacterProperties cp = textBoxDocument.BeginUpdateCharacters(textBoxDocument.Range.Start, 4);
    cp.ForeColor = System.Drawing.Color.Orange;
    cp.FontSize = 24;
    textBoxDocument.EndUpdateCharacters(cp);
    

    Use the following properties to determine whether an existing drawing object is a text box:

    The following code snippets (auto-collected from DevExpress Examples) contain references to the TextBox 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