Home > Backend Development > C++ > Why Did My Application Suddenly Become DPI-Aware Across Different Releases?

Why Did My Application Suddenly Become DPI-Aware Across Different Releases?

Mary-Kate Olsen
Release: 2025-01-28 09:02:11
Original
119 people have browsed it

Why Did My Application Suddenly Become DPI-Aware Across Different Releases?

DPI perception of different versions of the application of different versions

Some applications may unexpected DPI perception changes may occur between different versions. This difference may be attributed to external factors, such as changes in the use of third -party components or development environments.

In the specific case mentioned in the text, although the DPI perception is not clearly set in the application list, and the Windows API related to DPI is not directly called, the application becomes DPI perception in the subsequent version. This is likely to contain a DPI perception third -party component, which introduces DPI perception into the application.

In order to solve this problem, the following solutions can be considered:

Expressing DPI perception

In Visual Studio 2015-upd.1 or higher versions, by canceling the comments of the part and set it to False to declare DPI perception in the application list.

    or, use the Windows API function (such as SetProcessDPIAWARE or SETPROCESSDPIAWARENESSSSSSSSSSSSCONTEX).
  • Disable automatic DPI perception

add attributes to the assemblyinfo.cs file to disable the automatic DPI perception of the external component referenced by the WPF program set.

Other precautions
  • [assembly: System.Windows.Media.DisableDpiAwareness]
All third -party components and external dependencies used in the application are also perceived by DPI.

If the dpi perception causes the interface problem, consider redesigning the application to explicitly process DPI scaling, or use a thread -based SetThreadPiawarenessContext function to zoom in specific components while maintaining the remaining components.
  • See Microsoft's documentation to learn more about DPI perception:
  • High DPI desktop application development on Windows

  • Set the default DPI perception of the process

      Mixed mode DPI zoom and DPI perception API

The above is the detailed content of Why Did My Application Suddenly Become DPI-Aware Across Different Releases?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template