2

I have noticed this issue many times since Visual Studio 2010 but not all times. Now I am using Visual Studio 2019 most recent version. At design time I create controls like labels and buttons which shows very smooth text of Segoe UI font. After running Winform app the text on Labels and Buttons get creepy and not clear and smooth. I have attached Image for your reference to see the difference.

I have also checked Application.SetCompatibleTextRenderingDefault(false); and form AutoScaleMode and also DoubleBuffered but with no luck. Is this a long time bug in Visual Studio or some settings of the system.

Kindly provide me a perfect way around of this issue. ThanksScreenshot

p0iz0neR
  • 49
  • 6

2 Answers2

1

see this by @Hans Passant: https://stackoverflow.com/a/13228495/2696230 it has worked for me

[STAThread]
static void Main() {
    if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware();
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new Form1());             // Edit as needed
}

[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
Abdulkarim Kanaan
  • 1,703
  • 4
  • 20
  • 32
0

Not sure if you want the smoothness only approved for you (on your computer) or for everyone using your application.

If the goal is to only approve it for you then enable Cleartype and make sure to use a mordern font.

If not, then you can make a picture of your text and use a PictureBox instead of a TextBox, Label or whatever you are using and insert the picture of the text to the PictureBox.

You may also create a custom class and use this instead of your item, then you can override the OnPaint event and change the Graphics TextRenderingHint. Check out this Link to see how it can be done with a Label.

MarkusAnd
  • 750
  • 7
  • 21
  • Thanks Marcus but there are too many controls on my form and i dont want to override onpaint. Tell me how I can enable cleartype in Visual Studio. – p0iz0neR Mar 09 '20 at 14:32
  • Cleartype is not just activated for Visual Studios. It is a tool created by Microsoft to enhance text quality to make it easier to read. This can make quite a difference if you have an old screen with low resolution. Cleartype can only be activitated on Windows computers. To activate it on Windows, just search for Cleartype in your search bar and click "Adjust cleartype text", this starts a guide on how to activate it, hope it helps! – MarkusAnd Mar 09 '20 at 14:37
  • I have MSI gaming laptop with high performance graphics. ClearType also enabled in my windows settings but problem still there. I am 100% sure this is problem with Visual Studio. My app was working fine before but when i updated it today its controls font became creepy. Only in design mode font looks good but not on runtime – p0iz0neR Mar 09 '20 at 14:50
  • I see... Weird. What font are you using? If you are using an old font like Microsoft Sans Serif (which I think is the default font, atleast for older versions of Visual Studios) try and change it to a newer font such as Tahoma or Segoe UI. – MarkusAnd Mar 09 '20 at 14:57
  • I am using Segoe UI. Its too weird when you are using VSTUDIO 2019. – p0iz0neR Mar 09 '20 at 16:00