A few simple summaries of Windows high dpi (usually the default is the 100% Zoom Rate on window)

Source: Internet
Author: User

We know that with the support of high DPI, the Windows XP era started, when support for high DPI was relatively simple, but from vista/win7 to now win8/win8.1, Windows ' support for high DPI has changed a lot, Let's briefly introduce the following. If we had reason not to focus on high DPI in the previous XP era, then in the high-resolution era of the mobile device era and large display, we had no reason not to focus on high dpi, such as Surface Pro's resolution is 1920x1080, in this case if the system we do not set high dpi, Basically can't touch and operate, so now the normal program for high DPI support has become a trend.
  What dpi? The full name is dots per inch (DPI), which is the number of dots in each inch on the monitor, which is usually the 100% magnification by default on the window, but note that the value is not necessarily a true display physical value. Just one of our reference standards in Windows.   Let's think about why the font we see becomes larger when the DPI setting is high? Because the system font is designed in fixed size (Arial 10th, physical size (10/72) inches), when our DPI setting is high, it means that the font to occupy more pixels, and the screen resolution is not changed, it looks great. So if we set the high dpi, it usually means our monitor is high resolution, the fonts inside are too small, we need to increase the DPI to enlarge the content.   So how can our program support high DPI? For high DPI support, different operating systems have different scenarios. Generally speaking, if our program supports high dpi, it means that we should enlarge the content of the painting, such as fonts, pictures and controls. Of course, if we are using system fonts (such as Getstockobject (Default_gui_font)), then we do not need to worry about this situation, because the system will be the font at high DPI when the corresponding amplification; If we were to create our own fonts with CreateFont, we would have to zoom in on that font ourselves.   Below we see how XP is supported for high DPI?   XP support for high DPI is poor, most of the case is the enlargement of the font, of course, our program can also be GetDeviceCaps (HDC, logpixelsx) to get the DPI after the content of the painting to zoom.    below we see how VISTA/WIN7/WIN8 is supported for high DPI?   We know vista/win7 we can disable the DWM (Desktop Window Manager), which we call basic mode, which has the same high DPI effect as XP.   for the DWM is not banned, Vista/win7/win8 high DPI support is divided into 2 cases, specifically:   a XP-style high DPI support, which we discussed above, and another is through the  DWM Virtualization support for high DPI mode, below we discuss this way:   high DPI support is through the DWMZoom implementation, the specific process, such as our current system dpi is 200%, when our program runs, the system will tell you that the current DPI is still 96 (100%), so our program will still follow the 100% way of painting, But the coordinates that the system gives us are based on the DPI reduction (that is, when we call GetWindowRect on the window or the size of the GetSystemMetrics (Sm_cxscreen) is halved than the actual size), when we finish the drawing, The DWM then makes 200% magnification of the entire window and draws it to the screen, so it looks like our program automatically supports high DPI.    this way looks wonderful, but it also has drawbacks, mainly after the zoomed content will appear blurred, such as the text will have obvious aliasing.   Since the DWM virtualization user effect is sometimes not so good, we may often support high dpi on our own, how can we let our program disable the effect? In fact, we can set up and query the support for DWM virtualization for each process, and the system provides us with 2 api: setprocessdpiaware  and  isprocessdpiaware  By calling Setprocessdpiaware&nbsp, we tell the system not to do DWM virtualization for our program.   Here's a special case too: The coordinate information we get from the window handle at high DPI is associated with whether the target program supports DWM virtualization, and we call GetWindowRect for other program windows that support DWM virtualization. The coordinates that are taken are also the coordinates after the DWM is scaled, and the coordinates that are taken for the window that disables the DWM virtualization program are called GetWindowRect, which is the original coordinates that are not scaled.    Finally, we'll discuss the Win8.1 support for high DPI, WIn8.1 support for high DPI in 3 ways  Process_DPI_Awareness :  
typedef enum _PROCESS_DPI_AWARENESS {   process_dpi_unaware = 0,  process_system_dpi_aware = 1,  Process_per_monitor_dpi_aware = 2} process_dpi_awareness;
Here we discuss these 3 ways:   the first unaware, this way is to tell the system, my program does not support DPI aware, through the DWM virtualization to help us achieve. This approach is basically the same as the implementation of high DPI support above Win7/win8, the main difference is that the coordinates it takes from GetWindowRect are scaled by the DWM, regardless of whether the opposing window supports DWM virtualization.   The second way is System DPI aware, which tells the system that my program will support Dpi aware on the startup monitor, so I don't need to do DWM virtualization for me. But when my program is dragged to a different dpi-like monitor, let's start with system DWM virtualization scaling.   The third Way is per Monitor DPI aware, this mode is to tell the system, please never do DWM virtualization for me, I will myself for different Monitor dpi scaling ratio scaling.   re-introduce the relevant api:setprocessdpiawareness : Sets how high DPI is supported for the current process getprocessdpiawareness  : Query How a process supports high DPI getdpiformonitor : Gets the dpiwm_dpichanged&nbsp of a monitor; receive   When a program window is dragged to a different DPI monitor Finally, a brief summary, from the above we can see the Microsoft on different operating systems on the high-DPI support for the improvement of the line, in many respects also reflects their old program compatibility considerations, DWM Virtualization Although very simple, but lost the user experience.   ps, I tested on my machine and found that desktop programs are basically only Microsoft's own programs that are perfectly supported at high DPI, and most other programs, even Chrome, are high-dpi support through DWM virtualization. Of course now the WPF and window store apps are basically built-in to support high DPI.   Statistics, do your programs support high DPI?    reference: Writing dpi-aware Desktop and Win32 applications                & Nbsp; high DPI Settings in Windows

Http://www.cnblogs.com/weiym/p/3555068.html

A few simple summaries of Windows high dpi (usually the default is the 100% Zoom Rate on window)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.