Add the font dialog for the Happy Birthday App
The font dialog is shown modal: Nothing else happens until the dialog closes.
Add the font dialog for the Happy Birthday App
The font dialog is shown modal: Nothing else happens until the dialog closes.
Text of videoThis shows how to use the font dialog.
private void mnuFont_Click(object sender, EventArgs e)
{
// show the font dialog modal.
// Nothing else happens until the dialog closes.
fontDialog1.ShowDialog();
// If the user clicks cancel, the font will be null.
if(fontDialog1.Font != null)
{
// If not null change the font for lblHappy to selected font.
lblHappy.Font = fontDialog1.Font;
}
}
private void toolStripFont_Click(object sender, EventArgs e)
{
// Call the same method for the tool strip image as the menu item.
mnuFont_Click(sender, e);
}
Be sure to click Save All
after completing each step.