Sign in to follow this  
ArchG

[.net] [C#] Winforms and DPI

Recommended Posts

Hi, I made a couple applications that look fine and good, in normal 96 DPI, but some people that have used the software, have computers running 120 DPI, and it looks completely off, and doesn't have the look I was going for. I read a bit about making DPI-aware applications, but it doesn't seem like there is a very concrete way to do this, I thought maybe instead of using pixels for the size and positioning of elements, i'd use something like inches, but that seems to be a bigger pain because of the monitor sizes and different resolutions. Is there a standard way to get things to look the same across all DPI modes? Thanks.

Share this post


Link to post
Share on other sites
There is, but unfortunately WinForms decided to drop the use of device units and go with pixels directly. It was a dumb decision IMO, but we gotta live with it now :-)

When you design a form with the designer, it automatically takes font sizes into account and "should" automatically scale things at runtime for you. The problem usually comes in when you do your own sizing and positioning of elements. You've just got to remember to not use absolute pixel coordinates in your code - always try to base things relative to other things.

Also, on Vista, if you want to avoid the horrible blurry scaling that it does, you need to add a manifest to your application. (Don't get me started on the horrible support for high DPI displays in Vista... that's one feature where I believe they went backwards from XP)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this