Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,879 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This is my code and this way i am opening font dialog. how could i open font dialog with default font settings?
i want to set Font Name, Font Style, Font Size and underline etc when opening font dialog.
if (fontDlg.ShowDialog() == DialogResult.OK)
{
FontName = fontDlg.Font.Name;
FontStyle = fontDlg.Font.Style.ToString();
FontSize = fontDlg.Font.Size.ToString();
//if (FontSize.Contains("."))
// FontSize = FontSize.Split('.')[0];
UnderLine = fontDlg.Font.Underline;
IsFontChanged = true;
}
For example =>
FontDialog fontDialog1 = new FontDialog();
fontDialog1.Font = new System.Drawing.Font("Times New Roman", 10.0F, System.Drawing.FontStyle.Bold);
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
// code...
}