-2

while i am trying to implement font menu item in notepad , im not getting text changed , is there any mistake in my code

this is my code

private void fontMenuItem_Click(object sender, EventArgs e)
{
    FontDialog objFontForm = new FontDialog();
    objFontForm.ShowDialog();

}
4

1 に答える 1

3

これは、 DotNetPearlsから取得した非常に単純な例です。

//Create FontDialog instance
FontDialog fontDialog1 = new FontDialog();
// Show the dialog.
DialogResult result = fontDialog1.ShowDialog();
// See if OK was pressed.
if (result == DialogResult.OK)
{
    // Get Font.
    Font font = fontDialog1.Font;
    // Set TextBox properties.
    this.textBox1.Text = string.Format("Font is: {0}", font.Name);
    this.textBox1.Font = font;
}
于 2012-09-25T07:46:08.843 に答える