FontFamily 类

定义

定义有着相似的基本设计但在形式上有某些差异的一组字样。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 窗体一起使用。This example is designed to be used with a Windows Form. 若要运行此示例, 请ListBoxlistBox1窗体添加一个名为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)

从指定的一般字体系列初始化新 FontFamilyInitializes a new FontFamily from the specified generic font family.

FontFamily(String)

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

FontFamily(String, FontCollection)

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

属性

Families

返回一个数组,该数组包含与当前图形上下文相关的所有 FontFamily 对象。Returns an array that contains all the FontFamily objects associated with the current graphics context.

GenericMonospace

获取一般 monospace FontFamilyGets a generic monospace FontFamily.

GenericSansSerif

获取一般 sans serif FontFamily 对象。Gets a generic sans serif FontFamily object.

GenericSerif

获取一般 serif FontFamilyGets a generic serif FontFamily.

Name

获取此 FontFamily 的名称。Gets the name of this FontFamily.

方法

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()

释放此 FontFamily 使用的所有资源。Releases all resources used by this FontFamily.

Equals(Object)

指示指定的对象是否为 FontFamily 以及是否与此 FontFamily 相等。Indicates whether the specified object is a FontFamily and is identical to this FontFamily.

Finalize()

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

GetCellAscent(FontStyle)

返回指定样式的 FontFamily 的单元格上升,采用设计单位。Returns the cell ascent, in design units, of the FontFamily of the specified style.

GetCellDescent(FontStyle)

返回指定样式的 FontFamily 的单元格下降,采用设计单位。Returns the cell descent, in design units, of the FontFamily of the specified style.

GetEmHeight(FontStyle)

获取指定样式的 em 方形的高度,采用字体设计单位。Gets the height, in font design units, of the em square for the specified style.

GetFamilies(Graphics)

返回一个数组,该数组包含指定的图形上下文可用的所有 FontFamily 对象。Returns an array that contains all the FontFamily objects available for the specified graphics context.

GetHashCode()

获取此 FontFamily 的哈希代码。Gets a hash code for this FontFamily.

GetLifetimeService()

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

(继承自 MarshalByRefObject)
GetLineSpacing(FontStyle)

返回指定样式的 FontFamily 的行距,采用设计单位。Returns the line spacing, in design units, of the FontFamily of the specified style. 行距是两个连续文本行的基线之间的垂直距离。The line spacing is the vertical distance between the base lines of two consecutive lines of text.

GetName(Int32)

用指定的语言返回此 FontFamily 的名称。Returns the name, in the specified language, of this FontFamily.

GetType()

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

(继承自 Object)
InitializeLifetimeService()

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

(继承自 MarshalByRefObject)
IsStyleAvailable(FontStyle)

指示指定的 FontStyle 枚举是否可用。Indicates whether the specified FontStyle enumeration is available.

MemberwiseClone()

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

(继承自 Object)
MemberwiseClone(Boolean)

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

(继承自 MarshalByRefObject)
ToString()

将此 FontFamily 转换为可读的字符串表示形式。Converts this FontFamily to a human-readable string representation.

适用于

另请参阅