StringFormat 類別

定義

封裝文字配置資訊(例如對齊、方向和製表位)顯示操作(例如省略號插入和國家數位替代)和 OpenType 功能。 無法繼承這個類別。

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 許多常見的格式。 StringFormat 物件可以被更改。

Note

在 .NET 6 和更新版本中,只有 Windows作系統才支援包含此類型的 System.Drawing.Common 套件。 跨平台應用程式使用此類會引發編譯時警告及執行時異常。 如需詳細資訊,請參閱 僅限 Windows 上支援的 System.Drawing.Common。

建構函式

名稱 Description
StringFormat()

初始化一個新 StringFormat 物件。

StringFormat(StringFormat)

從指定的現有StringFormat物件初始化一個新StringFormat物件。

StringFormat(StringFormatFlags, Int32)

初始化 StringFormat 一個新的物件,使用指定的 StringFormatFlags 列舉方式與語言。

StringFormat(StringFormatFlags)

初始化一個新 StringFormat 物件,使用指定的 StringFormatFlags 枚舉方式。

屬性

名稱 Description
Alignment

取得或設定琴弦的水平對齊。

DigitSubstitutionLanguage

取得當地數字取代西方數字時所使用的語言。

DigitSubstitutionMethod

取得用於數字替換的方法。

FormatFlags

取得或設定 StringFormatFlags 包含格式資訊的枚舉。

GenericDefault

會拿到一個通用的預設 StringFormat 物件。

GenericTypographic

會得到一個通用的排版 StringFormat 物件。

HotkeyPrefix

取得或設定 HotkeyPrefixStringFormat 物件的物件。

LineAlignment

取得或設定弦的垂直對齊。

Trimming

取得或設定 StringTrimmingStringFormat 物件的枚舉。

方法

名稱 Description
Clone()

會建立這個 StringFormat 物件的精確複製品。

CreateObjRef(Type)

建立物件,其中包含產生用來與遠端物件通訊之 Proxy 所需的所有相關信息。

(繼承來源 MarshalByRefObject)
Dispose()

釋放此 StringFormat 物件所使用的所有資源。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
Finalize()

允許對象嘗試釋放資源,並在垃圾收集回收之前執行其他清除作業。

GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetLifetimeService()
已淘汰.

擷取控制這個實例存留期原則的目前存留期服務物件。

(繼承來源 MarshalByRefObject)
GetTabStops(Single)

取得這個 StringFormat 物件的制表止音。

GetType()

取得目前實例的 Type

(繼承來源 Object)
InitializeLifetimeService()
已淘汰.

取得存留期服務物件,以控制這個實例的存留期原則。

(繼承來源 MarshalByRefObject)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
MemberwiseClone(Boolean)

建立一個 MarshalByRefObject 目前物件的淺層複製品。

(繼承來源 MarshalByRefObject)
SetDigitSubstitution(Int32, StringDigitSubstitute)

規定以地方數字取代西方數字時所採用的語言與方法。

SetMeasurableCharacterRanges(CharacterRange[])

指定一組 CharacterRange 結構陣列,代表呼叫 MeasureCharacterRanges(String, Font, RectangleF, StringFormat) 該方法所測量的字元範圍。

SetTabStops(Single, Single[])

為此 StringFormat 物件設定制表位。

ToString()

將此 StringFormat 物件轉換為人類可讀的字串。

適用於

另請參閱