FontFamily.Families 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回陣列,這個陣列含有與目前圖形內容相關聯的所有 FontFamily 物件。
public:
static property cli::array <System::Drawing::FontFamily ^> ^ Families { cli::array <System::Drawing::FontFamily ^> ^ get(); };
public static System.Drawing.FontFamily[] Families { get; }
static member Families : System.Drawing.FontFamily[]
Public Shared ReadOnly Property Families As FontFamily()
屬性值
與目前圖形內容相關聯的 FontFamily 物件陣列。
範例
下列程式代碼範例顯示 類別的 FontFamily 屬性中的所有Families字型系列。 此範例的設計目的是要與 Windows Form 搭配使用。 若要執行此範例,請將名為 listBox1
的 ListBox 新增至窗體,並從表單的建構函式呼叫 PopulateListBoxWithFonts
方法。
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