FontDialog.Font Özellik

Tanım

Seçili yazı tipini alır veya ayarlar.

public:
 property System::Drawing::Font ^ Font { System::Drawing::Font ^ get(); void set(System::Drawing::Font ^ value); };
public System.Drawing.Font Font { get; set; }
member this.Font : System.Drawing.Font with get, set
Public Property Font As Font

Özellik Değeri

Font

Seçili yazı tipi.

Örnekler

Aşağıdaki kod örneği bir FontDialoggörüntülemek için kullanırShowDialog. Bu kod, Form üzerine yerleştirilen ve düğmesiyle önceden oluşturulmuş bir TextBox kod gerektirir. Ayrıca öğesinin fontDialog1 oluşturulmasını da gerektirir. Font boyut bilgilerini içerir ancak renk bilgilerini içermez.

private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      fontDialog1->ShowColor = true;

      fontDialog1->Font = textBox1->Font;
      fontDialog1->Color = textBox1->ForeColor;

      if ( fontDialog1->ShowDialog() != ::DialogResult::Cancel )
      {
         textBox1->Font = fontDialog1->Font;
         textBox1->ForeColor = fontDialog1->Color;
      }
   }
private void button1_Click(object sender, System.EventArgs e)
 {
    fontDialog1.ShowColor = true;

    fontDialog1.Font = textBox1.Font;
    fontDialog1.Color = textBox1.ForeColor;

    if(fontDialog1.ShowDialog() != DialogResult.Cancel )
    {
       textBox1.Font = fontDialog1.Font ;
       textBox1.ForeColor = fontDialog1.Color;
    }
 }
Private Sub button1_Click(sender As Object, e As System.EventArgs)
    fontDialog1.ShowColor = True

    fontDialog1.Font = textBox1.Font
    fontDialog1.Color = textBox1.ForeColor

    If fontDialog1.ShowDialog() <> DialogResult.Cancel Then
        textBox1.Font = fontDialog1.Font
        textBox1.ForeColor = fontDialog1.Color
    End If
End Sub

Şunlara uygulanır

Ayrıca bkz.