none
Bad resolution with TextRenderer RRS feed

  • Question

  • Hello!

    I am using TextRenderer to measure and draw text in Windows Forms applications. Everything worked well in Windows 7 and using up to 1920x1080 resolution. However, I recently switched to Windows 10 and am using a resolution of 2736x1824 (Surface Pro) and all text I am drawing is very low resolution and thus really bad quality.

    Unfortunately, I have not found any solution on the internet.

    Any advice will be much appreciated.

    Best regards,

    Christian

    Thursday, October 11, 2018 12:42 PM

Answers

  •  Perhaps you had the font scaling on your windows 7 computer set to 100% and your new windows 10 computer is using a higher font scale such as 150% or something.  This will make the text look fuzzy/blurry because windows forms are not Dpi aware by default and do not scale the text properly.

     For example,  I set my font scaling to 150% in the Display settings,  then I built 2 small test apps that use TextRenderer.DrawText.  I made one app Dpi Aware and left the other app non-Dpi Aware, it's default.  You can see how the text in the non-dpiaware top form is fuzzy/blurry and the text in the dpiaware bottom form is clear.

     

     If this looks like the problem you are having,  you can try/do one of two things....

     The first option is to enable the dpi aware setting in the app.manifest. In windows 7 with VS2015,  I know I can do this in the (Application Properties \ Application tab)  by clicking the (View Windows Settings) button to open the app.manifest file and un-comment the dpiaware setting (code shown below).  Remove the <!-- and --> to un-comment it.  Then Save,  Build,  and run.  I have had to close and reopen a project for this to take effect before but,  you might not need to do that.

      <!--
      <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings>
          <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
        </windowsSettings>
      </application>
      -->
     

     

     I am not sure if the above will work in Windows 10 or not though,  I do not have windows 10 and can not check it out.  It may involve a little more work in windows 10 if I read This Msdn Link correctly.  They recommend not changing it in the app.manifest for Win10 so,  you may need to change code in the app.config file instead of the app.manifest file.

     The other option is to set the font scale in your computer's display settings back to 100%.  However,  that will cause the fuzzy text if your app is run on another computer using higher font scaling.

     


    If you say it can`t be done then i`ll try it

    • Edited by IronRazerz Thursday, October 11, 2018 8:31 PM
    • Marked as answer by ChrisP1980 Tuesday, October 16, 2018 9:06 AM
    Thursday, October 11, 2018 8:29 PM