0

When I have created any application, all things is OK. But when I run it, quality reduced! In addition, size of forms or controls and design of them is currept. Also about alignment and anchors. bellow pictures show the problem.

A sample of quality loss

Another sample of quality loss

Albeit this happen just in my system. In other system that works truly. I tried it in virtual machine. It works truly but after a time, quality reduced too. By restore the windows, it is OK, but after a time, quality reduced again! Where is the problem?

Edit:

In other language and platforms such as ASP.net or Qt, this problem doesn't exist.

Morteza.M
  • 177
  • 13
  • It looks to me like your current DPI / display scaling settings are the culprit here; Windows Forms is known not to play nicely with higher DPI displays. If you don't want to switch to a more modern GUI framework like WPF, then you may have to try some workarounds to get your Windows Forms application to scale correctly. [This question here might be able to help you with that.](https://stackoverflow.com/questions/4075802/creating-a-dpi-aware-application) – Knowledge Cube Jun 15 '17 at 19:07
  • Thanks @ChristopherKyleHorton . In display settings, scale of text, apps, and other items has been fixed to 125%. I changed it to 100% and it worked. Thanks. – Morteza.M Jun 16 '17 at 12:04
  • Also, by putting below code to designer.cs, in scale 125% it works correctly! this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); – Morteza.M Jun 16 '17 at 12:12
  • Glad to hear that worked for you! You may want to add an answer to your own question detailing the steps you took and accept it once you are able. – Knowledge Cube Jun 16 '17 at 12:23
  • OK @ChristopherKyleHorton – Morteza.M Jun 16 '17 at 13:48

1 Answers1

0

By thanksgiving of @ChristopherKyleHorton that help me to find the answer, it is a problem with DPI.

In my display settings, scale of text, apps, and other items has been fixed to 125% (120 DPI). So, some of apps and items such as winform can't support this. For them, scale of text, apps, and other items must be 100% (96 DPI).

Also, if you don't like to change it, or your destination system use 125% too, you can add following code at the form.designer.cs in the initialize section:

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

This can solve the problem for ever. Thanks @ChristopherKyleHorton.

Morteza.M
  • 177
  • 13