FontFamily FontFamily FontFamily FontFamily Class

定義

定義具有相似基本設計和特定樣式變化的字體群組。Defines a group of type faces having a similar basic design and certain variations in styles. 這個類別無法被繼承。This class cannot be inherited.

public ref class FontFamily sealed : MarshalByRefObject, IDisposable
public sealed class FontFamily : MarshalByRefObject, IDisposable
type FontFamily = class
    inherit MarshalByRefObject
    interface IDisposable
Public NotInheritable Class FontFamily
Inherits MarshalByRefObject
Implements IDisposable
繼承
實作

範例

下列程式碼範例顯示中的所有字型家族Families屬性FontFamily類別。The following code example shows all the font families in the Families property of the FontFamily class. 這個範例被設計來搭配 Windows Form。This example is designed to be used with a Windows Form. 若要執行此範例中,新增ListBox名為listBox1至表單和呼叫PopulateListBoxWithFonts從表單的建構函式的方法。To run this example, add a ListBox named listBox1 to a form and call the PopulateListBoxWithFonts method from the form's constructor.

private:
   void PopulateListBoxWithFonts()
   {
      listBox1->Width = 200;
      listBox1->Location = Point(40,120);
      System::Collections::IEnumerator^ myEnum = FontFamily::Families->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         FontFamily^ oneFontFamily = safe_cast<FontFamily^>(myEnum->Current);
         listBox1->Items->Add( oneFontFamily->Name );
      }
   }
private void PopulateListBoxWithFonts()
{
    listBox1.Width = 200;
    listBox1.Location = new Point(40, 120);
    foreach ( FontFamily oneFontFamily in FontFamily.Families )
    {
        listBox1.Items.Add(oneFontFamily.Name);
    }
}
Private Sub PopulateListBoxWithFonts()
    listBox1.Width = 200
    listBox1.Location = New Point(40, 120)
    Dim oneFontFamily As FontFamily
    For Each oneFontFamily In FontFamily.Families
        listBox1.Items.Add(oneFontFamily.Name)
    Next
End Sub

建構函式

FontFamily(GenericFontFamilies) FontFamily(GenericFontFamilies) FontFamily(GenericFontFamilies) FontFamily(GenericFontFamilies)

從指定的泛用字型家族來初始化新的 FontFamilyInitializes a new FontFamily from the specified generic font family.

FontFamily(String) FontFamily(String) FontFamily(String) FontFamily(String)

使用指定的名稱,初始化新的 FontFamilyInitializes a new FontFamily with the specified name.

FontFamily(String, FontCollection) FontFamily(String, FontCollection) FontFamily(String, FontCollection) FontFamily(String, FontCollection)

使用指定的名稱,初始化指定之 FontFamily 中的新 FontCollectionInitializes a new FontFamily in the specified FontCollection with the specified name.

屬性

Families Families Families Families

傳回陣列,這個陣列含有與目前圖形內容相關聯的所有 FontFamily 物件。Returns an array that contains all the FontFamily objects associated with the current graphics context.

GenericMonospace GenericMonospace GenericMonospace GenericMonospace

取得泛用等寬 FontFamilyGets a generic monospace FontFamily.

GenericSansSerif GenericSansSerif GenericSansSerif GenericSansSerif

取得泛用 Sans Serif FontFamily 物件。Gets a generic sans serif FontFamily object.

GenericSerif GenericSerif GenericSerif GenericSerif

取得泛用 Serif FontFamilyGets a generic serif FontFamily.

Name Name Name Name

取得這個 FontFamily 的名稱。Gets the name of this FontFamily.

方法

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

釋放這個 FontFamily 所使用的所有資源。Releases all resources used by this FontFamily.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指出指定的物件是否為 FontFamily,並且是否和這個 FontFamily 相同。Indicates whether the specified object is a FontFamily and is identical to this FontFamily.

Finalize() Finalize() Finalize() Finalize()

允許物件在記憶體回收進行回收之前,嘗試釋放資源並執行其他清除作業。Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

GetCellAscent(FontStyle) GetCellAscent(FontStyle) GetCellAscent(FontStyle) GetCellAscent(FontStyle)

傳回指定的樣式之 FontFamily 的方格上移 (單位為設計單位)。Returns the cell ascent, in design units, of the FontFamily of the specified style.

GetCellDescent(FontStyle) GetCellDescent(FontStyle) GetCellDescent(FontStyle) GetCellDescent(FontStyle)

傳回指定的樣式之 FontFamily 的方格下移 (單位為設計單位)。Returns the cell descent, in design units, of the FontFamily of the specified style.

GetEmHeight(FontStyle) GetEmHeight(FontStyle) GetEmHeight(FontStyle) GetEmHeight(FontStyle)

取得指定樣式的 Em 方形高度 (單位為字型設計單位)。Gets the height, in font design units, of the em square for the specified style.

GetFamilies(Graphics) GetFamilies(Graphics) GetFamilies(Graphics) GetFamilies(Graphics)

傳回陣列,這個陣列含有指定圖形內容可使用的所有 FontFamily 物件。Returns an array that contains all the FontFamily objects available for the specified graphics context.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

取得這個 FontFamily 的雜湊程式碼。Gets a hash code for this FontFamily.

GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetLineSpacing(FontStyle) GetLineSpacing(FontStyle) GetLineSpacing(FontStyle) GetLineSpacing(FontStyle)

傳回指定的樣式之 FontFamily 的行距 (單位為設計單位)。Returns the line spacing, in design units, of the FontFamily of the specified style. 行距是兩連續文字行基準線 (Base Line) 間的垂直距離。The line spacing is the vertical distance between the base lines of two consecutive lines of text.

GetName(Int32) GetName(Int32) GetName(Int32) GetName(Int32)

傳回這個 FontFamily 的名稱 (使用指定的語言)。Returns the name, in the specified language, of this FontFamily.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

取得存留期服務物件,以控制這個執行個體的存留期原則。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
IsStyleAvailable(FontStyle) IsStyleAvailable(FontStyle) IsStyleAvailable(FontStyle) IsStyleAvailable(FontStyle)

指示指定的 FontStyle 列舉型別是否可以使用。Indicates whether the specified FontStyle enumeration is available.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

建立目前 MarshalByRefObject 物件的淺層複本。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ToString() ToString() ToString() ToString()

將這個 FontFamily 轉換為人們可讀取的字串表示。Converts this FontFamily to a human-readable string representation.

適用於

另請參閱