开发者

WPF DPI issues

I have developed an application that looks great on my computer but when I i开发者_运维技巧nstall it on other computers with different resolutions and DPI settings, it looks terrible. Controls overlap eachother and it's just miserable. Does anyone have any suggestions on how to avoid this?


There's no way for Windows to know the native DPI (Dots per inches) of your screen, since there's physically no way that the screen can tell it to the computer. This means that a lot of people will have DPI settings, that aren't the same as their monitors native DPI.

So- how does this fit into the whole "WPF used DIPs (Device independent pixels)"-debate? Well, for WPF to calculate how large to make a DIP, it needs 1 information and 1 invariant: It needs to know the resolution you're running (not a problem) and it needs for you to set your screen to its native DPI. If your screen it not set to the native DPI, pixels might be larger or smaller than they should, compared to the physical size of the screen.

It's quite hard to explain really, have a look at these blog posts: http://www.odewit.net/ArticleContent.aspx?id=WpfDpiScaling&lang=en&format=html http://blogs.microsoft.co.il/blogs/tomershamam/archive/2007/11/30/wpf-is-dpi-depended.aspx http://www.wpflearningexperience.com/?p=41 (Down right now :( )

In general, you should make your UI scalable with stuff like scrollbars, paging controls and the likes, to avoid overlaps :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜