FontDialog::Font Property
.NET Framework (current version)
Gets or sets the selected font.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The following code example uses ShowDialog to display a FontDialog. This code requires that a Form has already been created with a TextBox and button placed on it. It also requires that the fontDialog1 has been created. The Font contains the size information but not the color information.
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; } }
.NET Framework
Available since 1.1
Available since 1.1
Show: