Font backward incompatibility

I am using the Segoe interface for my winforms application.

In XP, this font does not exist, and I would like my application to use Verdana instead.

What is the best way to achieve this.

+3
source share
3 answers

It is always better to use the default font (system) to get the look. Therefore, Vista uses "Sergoe UI" as the default font, and XP uses "Tahoma" for this (not "Verdana"). To get the default dialog font, use the SystemFonts class:

protected override void OnLoad(EventArgs e)
{
  base.OnLoad(e);
  Font = SystemFonts.DialogFont;
}
+3
source

What you want is something like this:

Font GetUIFont()
{
    Font testFont = new Font("Segoe UI", 10f);
    if (testFont.Name == "Segoe UI")
        return testFont;
    else
        return new Font("Verdana", 10f);
}
0
source

JasonH, . , , , :

foreach (Control ctl in this.Controls)
{
    ctl.Font = GetUIFont();
}
0

Source: https://habr.com/ru/post/1710548/


All Articles