6/21/2019 9:08:07 PM
Viewed: 123
2/5/2013 4:59:47 PM
sửa lỗi Winform render control rất mờ

Do you use a high-dpi monitor? If yes, you need to set the AutoScaleMode property of your form toDpiinstead of Font. Then go to Program.cs and change your code as follow.

class Program
static void Main()
if (Environment.OSVersion.Version.Major >= 6)

Application.Run(new Form1());

private static extern bool SetProcessDPIAware();

Với VB.Net

My advise for designing forms to scale to different DPI's is to avoid the defaults that the designer sets.

In the designer, set the AutoScaleMode to Inherit and not the defaultFont. Then add a default Constructor (Public Sub New()) to the form's code and define the auto-scaling info there.

Public SubNew()
Me.AutoScaleDimensions=New System.Drawing.SizeF(96.0!,96.0!)
Me.AutoScaleMode= System.Windows.Forms.AutoScaleMode.Dpi

The AutoScaleDimensions property is set to what historically has been the base DPI of display devices (screens), 96 DPI.

By declaring these properties in the constructor versus the designer generated InitializeComponent` method, you do lose the scaling in the designer view for this specific form; the scaling will be applied at run-time. Any form that inherits from it will be displayed with scaling applied in the designer and should appear to have the same size as when run.

Next, manifest (add a app.manifest) the application to declare it DPI aware. There are various options for DPI awareness, but the basic from is:

You have to add a manifest specifying the privileges you require.

Choose Project->Add New Item..., and select Application Manifest File.


Fixing this after the damage has been done by VS overwriting factors based on the current design environment, is a game of trial and error. If the form appears to small, try a different base scale factor. Since(96.0!, 96.0!) is too small, a reasonable next attempt would be (120.0!, 120.0!); i.e. the form was originally designed at a 125% (96 * 1.25 = 120) zoom factor.

Gửi trả lời