Device Independent Pixel (DPI)
WPF introduces Device Independent DPI Settings for the applications built with it. For a window, it is very important to calculate how many Dots Per inch(DPI) the screen could draw. This is generally dependent on the hardware device and operating system in which the application runs and also how the DPI settings is applied on the Device. Any user can easily customize these settings and hence make the application look horrible. Windows forms application uses pixel based approach so with changing DPI settings, each control will change its size and look.
WPF addresses this issue and makes it independent of DPI settings of the computer. Let's look at how it is possible:
Let's say you have drawn a box, just like the one in the figure, which is 1 inch long in 96 dpi screen. Now if you see the same application in 120 dpi settings, the box will appear smaller. This is because the things that we see on the screen are totally dependent on dpi settings.
In case of WPF, this is modified to density based approach. That means when the density of pixel is modified, the elements will adjust them accordingly and hence the pixel of WPF application is Device Independent Pixel. As you can see in the figure, the size of the control remains the same in case of WPF application and it takes more pixels in case of 120 DPI application to adjust the size properly.
------解决方案--------------------------------------------------------
先贴上我的翻译:
Device Independent Pixel (DPI)
WPF introduces Device Independent DPI Settings for the applications built with it. For a window, it is very important to calculate how many Dots Per inch(DPI) the screen could draw. This is generally dependent on the hardware device and operating system in which the application runs and also how the DPI settings is applied on the Device. Any user can easily customize these settings and hence make the application look horrible. Windows forms application uses pixel based approach so with changing DPI settings, each control will change its size and look.
设备无关性
WPF介绍上说WPF构建的应用做到与DPI设置无关。对于一个窗口显示计算DPI(每英寸的像素数)是非常重要的。
但是这通常依赖于硬件设备、显示应用运行的操作系统以及当前应用于显示设备的DPI设置。任何用户都可以
轻松的定义这些设置,由此会带来不堪的应用显示效果(此处是胡翻的。。。)。窗口应用程序都是基于像素