TX Text Control .NET for Windows Forms

AutoSize Class

Class|Introduced in 11.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.dll
Install
dotnet add package TXTextControl.TextControl.WinForms.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.

Description

The AutoSize class is used with the TextControl.AutoControlSize property, to enable automatic expansion or shrinking of a Text Control's width or height. Additionally, it contains properties for setting maximum and minimum values. Automatic expansion or shrinking is only possible, if the TextControl.ViewMode property has been set to SimpleControl.

Syntax

public class AutoSize

Examples

The following example shows how to set up a TextControl that expands and shrinks horizontally with a maximum size of 600 pixels.

textControl1.ViewMode = TXTextControl.ViewMode.SimpleControl;
textControl1.AutoControlSize.AutoExpand = TXTextControl.AutoSizeDirection.Horizontal;
textControl1.AutoControlSize.AutoShrink = TXTextControl.AutoSizeDirection.Horizontal;
textControl1.AutoControlSize.MaxSize = new Size(600, 600);

The following example creates an Auto Size instance and configures its auto expand setting for a document workflow.

AutoSize autoSize = new();
autoSize.AutoExpand = AutoSizeDirection.Vertical;

Members

Constructors

ConstructorDescription
AutoSizeInitializes a new instance of the AutoSize class. The constructor offers the individual setting of all features.

Properties

PropertyDescription
AutoExpandGets or sets possible directions for expanding the control.
AutoShrinkGets or sets possible directions for shrinking the control.
MaxSizeGets or sets the maximum size, in pixels, for expanding the control. A control's width or hight cannot be larger than short.MaxValue.
MinSizeGets or sets the minimum size, in pixels, for shrinking the control. A control's width or hight cannot be smaller than the region covered by one character, so that at least one character remains visible.

Methods

MethodDescription
ResetMaxSizeNot described in the reference. public void ResetMaxSize();
ResetMinSizeNot described in the reference. public void ResetMinSize();