Inserting a Text Frame

A text frame is inserted by first creating an instance of the TextFrame class, and then adding it to the TextFrameCollection:

[C#]
TXTextControl.TextFrame newFrame = new TXTextControl.TextFrame(new Size(1000,1000));
textControl1.TextFrames.Add (newFrame, TXTextControl.HorizontalAlignment.Left,
    -1,TXTextControl.TextFrameInsertionMode.DisplaceText);
[Visual Basic]
Dim NewFrame As New TXTextControl.TextFrame(New Size(1000, 1000))
TextControl1.TextFrames.Add(NewFrame, TXTextControl.HorizontalAlignment.Left, _
    -1, TXTextControl.TextFrameInsertionMode.DisplaceText)

Once a text frame has been inserted, it can be activated by clicking on its border. An activated text frame can be moved and resized by dragging its border with the mouse.

Text Control provides a built-in dialog box for changing the appearance of a text frame. The dialog box is displayed using the TextFrameAttributesDialog method:

[C#]
textControl1.TextFrameAttributesDialog();
[Visual Basic]
TextControl1.TextFrameAttributesDialog()

The menu item which displays this dialog box should be disabled when no text frame is selected. This can be done in the menu's popup event, using the GetItem method of the TextFrame collection:

[C#]
mnuProperties.IsEnabled = (textControl1.TextFrames.GetItem() != null);
[Visual Basic]
mnuProperties.IsEnabled = (textControl1.TextFrames.GetItem() IsNot Nothing)

Next >>