2016-05-12 51 views
5

在Windows 10上運行我們的Windows窗體應用程序之一時,GUI看起來很糟糕,因爲縮放看起來很糟糕。 下面是一些1920×1080的屏幕截圖(注意第二對不同尺寸): Win 10Windows 10上的Windows窗體應用程序無法正常縮放

Win 7

Win 10

Win 7

在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上看起來完全一樣嗎?

回答

4

嘗試更改Windows上的設置  7和Windows   8至100%。我不認爲這是一個Windows問題。可能是因爲Windows   10中的默認設置不同。

你可以嘗試用AutoScaleMode Enumeration「玩」。

試圖爲形式的模式設置爲dpi的described here

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; 

而且閱讀答案this SO question約在不同的控制比例。

+3

謝謝你,AutoScaleMode指導我找到正確的解決方案。我已將它設置爲所有格式的「Dpi」,現在看起來更好。還需要一個更改是字體:我已經注意到我們的默認字體「Microsoft Sans Serif」在Windows 10上呈現的方式更大,這也造成了問題,所以我將它更改爲Arial,它在Windows 7上具有相似的尺寸和10。 – Cleo

0

我有一個類似的問題。某些組合框在Windows窗體應用程序中顯示得太寬。它在Windows上運行,但不是在Windows上運行。

在Windows 10上將DPI縮放比例從125%設置爲100%。 AutoSizeScaleMode是字體。

相關問題