Bagikan melalui


FontFamily.Name Properti

Definisi

Mendapatkan nama ini FontFamily.

public:
 property System::String ^ Name { System::String ^ get(); };
public string Name { get; }
member this.Name : string
Public ReadOnly Property Name As String

Nilai Properti

String yang mewakili nama ini FontFamily.

Contoh

Contoh kode berikut menunjukkan semua keluarga font di Families properti FontFamily kelas . Contoh ini dirancang untuk digunakan dengan Formulir Windows. Untuk menjalankan contoh ini, tambahkan bernama ListBoxlistBox1 ke formulir, dan panggil PopulateListBoxWithFonts metode dari konstruktor formulir.

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

Berlaku untuk