How to get rid of this “edge” in .NET Winforms app?

a 夏天 提交于 2019-12-24 11:53:18

问题


I have a .NET Winforms app that is showing odd edges that I can't get rid of. The edges only appear when <dpiAware> is set to true in app.manifest. I'm on Windows 10 with a high-DPI screen. See the picture below. Any ideas?


回答1:


Check whether you use next settings, in:

app.config file:

<System.Windows.Forms.ApplicationConfigurationSection> <add key="DpiAwareness" value="PerMonitorV2" /> </System.Windows.Forms.ApplicationConfigurationSection>

Main() of you application, you set these:

Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);

Designer file of you form, the properties of the form:

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

The problem, you described above, can be reproducible when you use 2 monitors with different dpi scale. Your main monitor uses 200% and your secondary 100%. To fix it you can change the "primary" monitor setting to change the main monitor



来源:https://stackoverflow.com/questions/55108044/how-to-get-rid-of-this-edge-in-net-winforms-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!