StringFormat 类

定义

封装文本布局信息(如对齐、文字方向和 Tab 停靠位),显示操作(如省略号插入和国家标准 (National) 数字替换)和 OpenType 功能。Encapsulates text layout information (such as alignment, orientation and tab stops) display manipulations (such as ellipsis insertion and national digit substitution) and OpenType features. 此类不能被继承。This class cannot be inherited.

public ref class StringFormat sealed : MarshalByRefObject, ICloneable, IDisposable
public sealed class StringFormat : MarshalByRefObject, ICloneable, IDisposable
type StringFormat = class
    inherit MarshalByRefObject
    interface ICloneable
    interface IDisposable
Public NotInheritable Class StringFormat
Inherits MarshalByRefObject
Implements ICloneable, IDisposable
继承
StringFormat
实现

注解

许多常见格式是通过枚举提供StringFormatFlags的。Many common formats are provided through the StringFormatFlags enumeration. StringFormat可以更改对象。StringFormat objects can be changed.

构造函数

StringFormat()

初始化新的 StringFormat 对象。Initializes a new StringFormat object.

StringFormat(StringFormat)

从指定的现有 StringFormat 对象初始化新 StringFormat 对象。Initializes a new StringFormat object from the specified existing StringFormat object.

StringFormat(StringFormatFlags)

用指定的 StringFormatFlags 枚举初始化新 StringFormat 对象。Initializes a new StringFormat object with the specified StringFormatFlags enumeration.

StringFormat(StringFormatFlags, Int32)

用指定的 StringFormat 枚举和语言初始化新的 StringFormatFlags 对象。Initializes a new StringFormat object with the specified StringFormatFlags enumeration and language.

属性

Alignment

获取或设置字符串的水平对齐方式。Gets or sets horizontal alignment of the string.

DigitSubstitutionLanguage

获取用本地数字替换西方数字时使用的语言。Gets the language that is used when local digits are substituted for western digits.

DigitSubstitutionMethod

获取要用于数字替换的方法。Gets the method to be used for digit substitution.

FormatFlags

获取或设置包含格式化信息的 StringFormatFlags 枚举。Gets or sets a StringFormatFlags enumeration that contains formatting information.

GenericDefault

获取一般的默认 StringFormat 对象。Gets a generic default StringFormat object.

GenericTypographic

获取泛型版式 StringFormat 对象。Gets a generic typographic StringFormat object.

HotkeyPrefix

获取或设置此 StringFormat 对象的 HotkeyPrefix 对象。Gets or sets the HotkeyPrefix object for this StringFormat object.

LineAlignment

获取或设置字符串的垂直对齐方式。Gets or sets the vertical alignment of the string.

Trimming

获取或设置此 StringFormat 对象的 StringTrimming 枚举。Gets or sets the StringTrimming enumeration for this StringFormat object.

方法

Clone()

创建此 StringFormat 对象的一个精确副本。Creates an exact copy of this StringFormat object.

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Dispose()

释放由此 StringFormat 对象使用的所有资源。Releases all resources used by this StringFormat object.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
Finalize()

在垃圾回收将某一对象回收前允许该对象尝试释放资源并执行其他清理操作。Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetTabStops(Single)

获取此 StringFormat 对象的制表位。Gets the tab stops for this StringFormat object.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
SetDigitSubstitution(Int32, StringDigitSubstitute)

指定将本地数字替换为西方数字时所使用的语言和方法。Specifies the language and method to be used when local digits are substituted for western digits.

SetMeasurableCharacterRanges(CharacterRange[])

指定 CharacterRange 结构的数组,这些结构表示通过调用 MeasureCharacterRanges(String, Font, RectangleF, StringFormat) 方法来测定的字符的范围。Specifies an array of CharacterRange structures that represent the ranges of characters measured by a call to the MeasureCharacterRanges(String, Font, RectangleF, StringFormat) method.

SetTabStops(Single, Single[])

为此 StringFormat 对象设置制表位。Sets tab stops for this StringFormat object.

ToString()

将此 StringFormat 对象转换为可读的字符串。Converts this StringFormat object to a human-readable string.

适用于

另请参阅