Today, I am going to show you how to display a frame around a paragraph. Users often request this as a new feature for a future version as they are not aware that this is already implemented in TX Text Control. They also tried to simulate it using tables (which is possible as well).

A frame can be specified in the ParagraphFormat class using 4 different settings:

Frame: This sets the frame around a paragraph. You could specify whether the frame is a box or just a line at the left, right, bottom or top of the paragraph. Additionally, the Frame property offers a possibility to specify a merged box. In this case, the paragraph has got a complete frame. If the following paragraph has a frame too, the frames are merged to a single boxed frame.

FrameDistance: Sets the distance between the text and the frame.

FrameLineWidth: Sets the width of the frame lines.

FrameStyle: Specified whether the frame is displayed as a single or a double line.

The following sample code inserts a double lined frame to the current paragraph.

Dim myFrameStyle As New TXTextControl.ParagraphFormat

myFrameStyle.Frame = TXTextControl.Frame.Box
myFrameStyle.FrameDistance = 200
myFrameStyle.FrameLineWidth = 50
myFrameStyle.FrameStyle = TXTextControl.FrameStyle.Double

TextControl1.ParagraphFormat = myFrameStyle