2012-01-03 44 views
9

可能重複:
How do I detect if the user's font (DPI) is set to small, large, or something else?確定Windows 7通過C#設置的字體大小?

我正在尋找一種方式來恢復設置,如下面的圖片中使用?

謝謝?

enter image description here

+1

http://nickstips.wordpress.com/2010/11/08/c-programmatically-get-the-current-dpi-setting/ – SLaks 2012-01-03 21:11:14

+2

另外值得注意的是,如果用戶更改設置,而你的應用程序是開放的。請參閱[MSDN文章如何:在Windows窗體應用程序中響應字體方案更改](http://msdn.microsoft.com/zh-cn/library/ms229594.aspx) – 2012-01-03 21:16:46

回答

2

檢查課下SystemFonts。我認爲你不需要超過默認的命名空間。

string name = SystemFonts.IconTitleFont.FontFamily.Name; 
float size = SystemFonts.IconTitleFont.Size; 
+0

http://msdn.microsoft.com /en-us/library/system.drawing.systemfonts.aspx是MSDN的鏈接 – Bueller 2012-01-03 21:14:04

+1

OP詢問的特定屏幕是DPI。 – vcsjones 2012-01-03 21:16:16

1

我相信這是已經在這裏回答:

How to get Windows Display settings?

的IconTitleFont信息將只是給你的字體大小,而你似乎在尋找的放大級別。

+0

我嘗試過,但與其他一些用戶的結果相同。結果不可靠。 – JimDel 2012-01-03 21:37:37