Reputation: 49
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. Thanks
Upvotes: 2
Views: 1219
Reputation: 1763
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();
Upvotes: 1
Reputation: 812
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
.
Upvotes: 0