System.Windows.Forms.FontDialog not picking up the font family correctly.

Shivani Sabnis 1 Reputation point
2022-12-14T06:48:39.723+00:00

I am using System.Windows.Forms.FontDialog for showing font styling popup in my WPF application.
I selected @Ms Gothic font, but that dialog returning MS Gothic font.
And this behavior is similar for all the font families which includes "@" in their name.

![270431-image.png]2

270441-image.png

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,903 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,784 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
814 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 118.1K Reputation points
    2022-12-14T20:28:58.067+00:00

    If you really need the "@" prefix, then try this:

    string n = ( fd.Font.GdiVerticalFont ? "@" : "" ) + fd.Font.FontFamily.Name;  
    m_model.FontFamilyName = n;  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.