1

I am trying to use System.Windows.Media.Typeface to get some details of a font.
When I use it in my WinForms application the UI is resizing and the fonts are changing. I noticed that my display resolution is at 125%. When I test this on 100% screen it does not happen.

Is there any issue of referencing PresentationCore.Dll in a winforms app. Or is it about Typeface class.

 namespace WindowsFormsApp1
{
    public partial class WinFormample : Form
    {
        public WinFormample()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            System.Windows.Media.Typeface t = new System.Windows.Media.Typeface("Arial");
        }
    }
}
Stan1k
  • 338
  • 2
  • 17
  • 1
    Read the notes here: [DPI Awareness - Unaware in one Release, System Aware in the Other](https://stackoverflow.com/a/50276714/7444103). In short, when you reference PresentationFramework assemblies, your WinForms app, if not already DpiAware, will become DpiAware (`SystemAware`). You either make your app DpiAware (you really should) or disable the automatic feature, as described in the last paragraph. – Jimi Mar 04 '21 at 09:55

0 Answers0