Skip to main content
A newer version of this page is available. .

How to: Insert Rich Text in the TextBox

The following code inserts a paragraph and a picture from the main document into the text box. The TextBox.Document property provides access to the text box content.

document.AppendText("Line One\nLine Two\nLine Three");
Shape myPicture = document.Shapes.InsertPicture(document.CreatePosition(15), 
    System.Drawing.Image.FromFile("beverages.png"));
myPicture.HorizontalAlignment = ShapeHorizontalAlignment.Center;