TX Text Control .NET Documentation

Selection Class

The Selection class describes and handles the attributes of a text selection. Each of the properties of this class returns the property's default value if the selection does not contain a common value. In this case the IsCommonValueSelected method returns false.

Syntax:
[C#] public class Selection
[Visual Basic] Public Class Selection

Constructors

ConstructorDescription
SelectionInitializes a new instance of the Selection class.

Properties

PropertyDescription
BaselineGets or sets the baseline alignment, in twips, of the selected text.

BoldGets or sets the bold attribute of the selected text.

FontNameGets or sets the font of the selected text.

FontSizeGets or sets the font's size, in twips, of the selected text.

ForeColorReturns or sets the color used to display the selected text.

FormattingStyleGets or sets the formatting style of the selected text.

ItalicGets or sets the italic attribute of the selected text.

LengthReturns or sets the number of characters selected.

ListFormatGets or sets a bulleted or numbered list and/or its formatting attributes for the selected text.

ParagraphFormatGets or sets the formatting attributes of the selected paragraphs.

SectionFormatGets or sets page settings such as margins, size and orientation for the selected text.

StartGets or sets the starting point of selected text.

StrikeoutGets or sets the strikeout attribute of the selected text.

TextGets or sets a string containing the currently selected text.

TextBackColorGets or sets the background color for selected text.

UnderlineGets or sets underlining styles for the selected text.

Methods

MethodDescription
IsCommonValueSelectedOverloaded. Informs about whether a certain attribute has the same value for the complete selection.

LoadOverloaded. Exchanges the selected text with text in a certain format.

SaveOverloaded. Saves the selected text in a file, a byte array or as a string with a specified format.

Enumerations

EnumerationDescription
AttributeDetermines a certain attribute.

Example:The following example shows how to select and format a piece of text.
[C#] textControl1.Text = "TX Text Control"; TXTextControl.Selection mySel = new TXTextControl.Selection(3, 4); mySel.Bold = true; mySel.Italic = true; textControl1.Selection = mySel;
[Visual Basic] TextControl1.Text = "TX Text Control" Dim mySel as TXTextControl.Selection = New TXTextControl.Selection(3, 4) mySel.Bold = True mySel.Italic = True TextControl1.Selection = mySel
See also:Text Selections and Character Input, Graphical Overview.