2

I have a C# programm, that convert Text to Image by using GDI+ method Graphics.DrawString

On my machine with Windows 7 it works good

see example image here:

enter image description here

enter image description here

But on the Windows Server 2019 it creates blurry, not clear image

see example image here:

enter image description here

enter image description here

I even tried to use GDI method TextRenderer.DrawText

but it gave same blur (see links above)

I tried to install .NET Framework 4.8, all Visual C++ Redistributables but had no sucess

phuzi
  • 12,078
  • 3
  • 26
  • 50
Du10
  • 67
  • 5

1 Answers1

0

Thanks to comment of Selvin, I found the solution

on GDI TextRenderer.DrawText

graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

on GDI+ Graphics.DrawString

graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
Du10
  • 67
  • 5
  • With the tool "insert code" you can remove the overindenting, thus allowing better formatting. – Soleil Dec 10 '20 at 14:26