Products Technologies Demo Docs Blog Support Company

Displaying a Frame Around a Paragraph

The ParagraphFormat class in TX Text Control supports adding visible frames around paragraphs. Developers configure the border type with Frame, inner spacing with FrameDistance, line thickness with FrameLineWidth, and appearance with FrameStyle for single or double line rendering.

Displaying a Frame Around a Paragraph

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

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

Windows FormsWPF.NET

Create a Table of Contents in Windows Forms using C#

This article explains how to create a table of contents in Windows Forms using the ribbon or programmatically. Creating a table of contents is required to organize large documents.


Windows FormsList.NET

Two Ways to Restart Numbered Lists in TX Text Control

In TX Text Control, numbered lists are continued by default and need to be reset when required. There is more than one way if you want to restart numbered lists in a document. In this article, two…


.NETSample

Paste Special: The Easy Way to Implement

TX Text Control version 15.0 introduced a ClipboardFormat parameter on the Paste method, enabling native Paste Special functionality. The GetClipboardFormats method returns all available clipboard…


.NETSampleSections

How to Remove All Section Breaks in a Document?

TX Text Control 15.0 adds per-section page column support alongside existing section breaks. To remove all section breaks programmatically, iterate through SectionCollection using…


.NETPrintingSample

Batch Printing: How to Print Documents in One Print Job

Batch printing multiple documents as a single print job using TX Text Control relies on a .NET PrintDocument with PrintPage and QueryPageSettings events. Each page is rendered individually via the…

Share on this blog post on: