in C# winform, I got: “only truetype fonts are supported. This is not a TrueType Font”

后端 未结 5 416
孤街浪徒
孤街浪徒 2021-01-01 13:05

I have C# winform, I installed a couple of ttf fonts, but when i set the text box font to any of the ones i downloaded, i get this error Even though I\'m 100% sure that the

相关标签:
5条回答
  • 2021-01-01 13:18

    This happens when you install new fonts while Visual Studio is running. Close Visual Studio, and then reopen it. The problem will be solved.

    0 讨论(0)
  • 2021-01-01 13:27

    After downloading the font, I simply double-clicked it and hit 'Install'. However, this did not work, the font was not displayed in Win 10 Font Settings, besides that it was in the /Windows/Fonts/ folder. Some programs did find the font (such as Gimp), others, like VS or even Win10 itself - did not find them. After a restart, the font was not shown again (until a new double-ckicl/install).


    Solution: Right-click on the Font and select 'Install for all Users'

    0 讨论(0)
  • 2021-01-01 13:29

    Try

    private void Form1_Load(object sender, System.EventArgs e) {
        label1.Font = new Font("myFont", 12, FontStyle.Regular);
    }
    
    0 讨论(0)
  • 2021-01-01 13:31

    Have font with License "Source Sans Pro". Installed and usable in every MS-Application. For VS Forms-Project, i needed to "reinstall" it with

    Right-click on the Font and select 'Install for all Users'

    After VS restart, the misleading error vanished.

    0 讨论(0)
  • 2021-01-01 13:34

    Use nuget WpfColorFontDialog in the WPF projects instead, this supports OpenType fonts.

    0 讨论(0)
提交回复
热议问题