在Windows 10上運行我們的Windows窗體應用程序之一時,GUI看起來很糟糕,因爲縮放看起來很糟糕。 下面是一些1920×1080的屏幕截圖(注意第二對不同尺寸): Windows 10上的Windows窗體應用程序無法正常縮放
在Windows 10顯示設置縮放選項被設置爲100%(所以不應該使用額外的縮放)。 此外,下面的代碼是在程序開始執行:
static void Main()
{
if (Environment.OSVersion.Version.Major >= 6) //Windows Vista and higher
SetProcessDPIAware(); //disable DPI scaling (or something like that) to avoid scaling problems on Windows 10
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(Hauptmenue.Instance);
}
該代碼塊可以幫助一點,因爲它看起來在Windows 10差了不少沒有。 但是這還不夠好......有人知道如何「恢復」GUI在Windows 7或8上看起來完全一樣嗎?
謝謝你,AutoScaleMode指導我找到正確的解決方案。我已將它設置爲所有格式的「Dpi」,現在看起來更好。還需要一個更改是字體:我已經注意到我們的默認字體「Microsoft Sans Serif」在Windows 10上呈現的方式更大,這也造成了問題,所以我將它更改爲Arial,它在Windows 7上具有相似的尺寸和10。 – Cleo