Unlike WinForm, WPF has a metric unit that is not pixel, but is designed to have an diu, which is always 1/96 inches in size.
So how many pixels is a button in WPF with a width of 96?
A: It depends on the system dpi.
The calculation formula is: The actual pixel = is not equipped with the dimensions * system dpi
In this way, when the system DPI is 96 (Windows defaults), the button takes up just 96 pixels, and the system DPI 120 takes up 120 pixels.
The pixel dimensions are available, and then the screen dpi is known, and the physical dimensions can be calculated.
The screen DPI is determined by the screen size and resolution.
For example: 12.5-inch notebook, 1366*768 screen dpi approx 125dpi;18.5, 1366*768 screen dpi approximately 85dpi
It's not hard to figure out that 96 pixels are less than 1 inches longer in the notebook and more than 1 inches on a Taiwanese machine.
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/
Usually the LCD display has a natural resolution, which is best displayed at that resolution, so the screen dpi can be fixed, and when the factory is set up, it is decided.
The screen dpi is called Hard dpi (which is unlikely to change), and the previous system DPI is software dpi (which can be modified in Control Panel).
With so many, what are the advantages of the WPF metric system?
A: If only does not have the advantage of using the DPI,WPF system and WinForm compared with the implied systems. Because WPF's metric units are equal to pixels at this time, the table is exactly the same.
While changing the system dpi, the advantages of WPF are now coming out.
For example, when the system DPI is increased to 120, WPF automatically adds pixel dimensions to show more detail, so that the control becomes larger and the details are clearer.
The size of the WinForm, however, is not automatically changed, or the old, although the system provides a higher pixel density, but WinForm does not show more detail.
This way of WPF is sometimes problematic, for example: Specifying a window with a width of 1366 is OK at the implied system DPI, but if you increase the system dpi, the window will go beyond the screen.
This is the WinForm fixed pixel approach that doesn't matter, so the pros and cons also need to see the scene.