In This Article

TextStyle Class

Represents style attributes of text.

public class TextStyle : ICloneable
Inheritance:
object object
Implements:
ICloneable

Constructors

TextStyle()

Initializes an instance of the class with default values.

public TextStyle()

TextStyle(string, double, Color)

Initializes an instance of the class with the specified font family name, font size, and font color.

public TextStyle(string fontFamilyName, double fontSize, Color textColor)
Parameter Type Description
fontFamilyName string

The font family name.

fontSize double

The font size.

textColor Color

The text color.

Properties

Bold

Indicates if bold is active.

public bool Bold { get; set; }

Property Value

bool

FontFamilyName

The font family name.

public string? FontFamilyName { get; set; }

Property Value

string:

A string value, or null for the default font.

FontSize

The font size.

public double FontSize { get; set; }

Property Value

double

Italic

Indicates if italic is active.

public bool Italic { get; set; }

Property Value

bool

TextColor

The text color.

public Color TextColor { get; set; }

Property Value

Color

Underline

Indicates if underline is active.

public bool Underline { get; set; }

Property Value

bool

Methods

Clone()

Creates a new object that is a copy of the current instance.

public TextStyle Clone()

Returns

TextStyle:

A new object that is a copy of this instance.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)
Parameter Type Description
obj object

The object to compare with the current object.

Returns

bool:

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int:

A hash code for the current object.

Inherited Members

Extension Methods