VSTO and WPF with High DPI results in small fonts RRS feed

  • Question

  • I'm currently creating a VSTO AddIn for Outlook 2013 with Custom Task Panes, WPF, C#, .NET 4.5

    For the custom task pane I'm using a WinForms UserControl that hosts a WPF UserControl. It works fine on default DPI setting, but I also have a notebook with QHD+ 3200x1800 pixel: Images and for example the rectangle of a CheckBox seems to have a correctly scaled size, but the font is too small.

    I'm have the WinForms UserControl AutoScale to Inherit and tried all other options with no effect.

    I don't have a font size specified - everything is default

    Thanks for your help.



    • Edited by BernhardE Thursday, November 13, 2014 6:55 AM
    Thursday, November 13, 2014 6:51 AM


  • I found the solution by myself. It is very easy. A WPF User Control inside an ElementHost Control uses the font of the parent Windows Forms Control or Form. So just set the font correctly there during initialization...

    this.Font = new Font(System.Drawing.SystemFonts.MessageBoxFont.FontFamily, System.Drawing.SystemFonts.MessageBoxFont.Size, System.Drawing.SystemFonts.MessageBoxFont.Style);

    • Marked as answer by BernhardE Monday, November 24, 2014 8:15 AM
    • Edited by BernhardE Monday, November 24, 2014 10:33 AM
    Monday, November 24, 2014 8:15 AM