Resolution of the Cefsharp high DPI problem

Source: Internet
Author: User



Using the Cefsharp control, in some high-resolution computers (showing a scale of not 100%, but 120% or 125%, etc.), the following situations occur:









A black edge appears in the displayed page, and the button is also biased, such as clicking on the "Layers" button and clicking on the relative position in the black border above.






Solution:



1, in the current computer desktop, right-display settings, the display scale adjustment to 100% (need to restart the computer to take effect), then look, the display is normal;



2, in the current project, add an "application manifest file" (app.manifest), under the root node (assembly), add the following code, rerun the program, and Method 1 is the same effect:


 <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
    </windowsSettings>
  </application>


3, the use of cefsharp self-bringing method:



Find Cef.initialize (setting); statement, under which add cef.enablehighdpisupport ();



When the program loads the Chromiumwebbrowser control, it adjusts the current display scale to 100%.


 
   Cef.Initialize(setting);
            Cef.EnableHighDPISupport();



Preference for "Method 3"



Resolution of the Cefsharp high DPI problem


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.