• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class StringFormat

Encapsulates text layout information such as alignment, format flags, and tab stops.

Inheritance
object
StringFormat
Implements
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DRIT.Drawing.Text
Assembly: DRIT.Drawing.dll
Syntax
public sealed class StringFormat : IDisposable
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

Constructors

StringFormat()

Initializes a new StringFormat with default settings.

Declaration
public StringFormat()
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

StringFormat(StringFormat)

Initializes a new StringFormat as a copy of an existing format.

Declaration
public StringFormat(StringFormat format)
Parameters
Type Name Description
StringFormat format

The format to copy.

Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

StringFormat(StringFormatFlags)

Initializes a new StringFormat with the specified format flags.

Declaration
public StringFormat(StringFormatFlags options)
Parameters
Type Name Description
StringFormatFlags options

The format flags to apply.

Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

Properties

Alignment

Gets or sets the horizontal text alignment.

Declaration
public StringAlignment Alignment { get; set; }
Property Value
Type Description
StringAlignment
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

FirstLineIndent

Gets or sets the additional horizontal indentation of the first visual line.

Declaration
public float FirstLineIndent { get; set; }
Property Value
Type Description
float
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

FormatFlags

Gets or sets the format flags that control text layout.

Declaration
public StringFormatFlags FormatFlags { get; set; }
Property Value
Type Description
StringFormatFlags
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

GenericDefault

Gets a StringFormat with default settings.

Declaration
public static StringFormat GenericDefault { get; }
Property Value
Type Description
StringFormat
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

GenericTypographic

Gets a StringFormat with typographic settings.

Declaration
public static StringFormat GenericTypographic { get; }
Property Value
Type Description
StringFormat
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

HotkeyPrefix

Gets or sets the hotkey prefix handling for text.

Declaration
public HotkeyPrefix HotkeyPrefix { get; set; }
Property Value
Type Description
HotkeyPrefix
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

LineAlignment

Gets or sets the vertical text alignment.

Declaration
public StringAlignment LineAlignment { get; set; }
Property Value
Type Description
StringAlignment
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

Trimming

Gets or sets the trimming behavior for text that overflows the layout rectangle.

Declaration
public StringTrimming Trimming { get; set; }
Property Value
Type Description
StringTrimming
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

Methods

Clone()

Creates an exact copy of this StringFormat.

Declaration
public StringFormat Clone()
Returns
Type Description
StringFormat

A new StringFormat with the same settings.

Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

Dispose()

Releases all resources used by this format.

Declaration
public void Dispose()
Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

GetMeasurableCharacterRanges()

Gets the character ranges that can be measured.

Declaration
public CharacterRange[] GetMeasurableCharacterRanges()
Returns
Type Description
CharacterRange[]

An array of character ranges.

Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

GetTabStops(out float)

Gets the tab stops for this format.

Declaration
public float[] GetTabStops(out float firstTabOffset)
Parameters
Type Name Description
float firstTabOffset

The offset of the first tab stop.

Returns
Type Description
float[]

An array of tab stop positions.

Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

SetMeasurableCharacterRanges(CharacterRange[])

Sets the character ranges that can be measured.

Declaration
public void SetMeasurableCharacterRanges(CharacterRange[] ranges)
Parameters
Type Name Description
CharacterRange[] ranges

The array of character ranges.

Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

SetTabStops(float, float[])

Sets the tab stops for this format.

Declaration
public void SetTabStops(float firstTabOffset, float[] tabStops)
Parameters
Type Name Description
float firstTabOffset

The offset of the first tab stop.

float[] tabStops

The array of tab stop positions.

Remarks

A StringFormat is used with Graphics.DrawString to control text alignment, line spacing, trimming, and other formatting options.

Implements

IDisposable
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX