-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DpiAware: problem with ControlBox #97
Comments
Is this a suggested fix? |
I know why you ask - I forgot to mention something: the problem occurs when the interface scaling in the system is greater than 100% - then the application scales. |
SetProcessDpiAware is the same as right click -> properties -> compatibility -> change high DPI settings -> high DPI scalling override: application on exe, or link. |
I don't know how to fix it. |
Oh sorry, NOT ALWAYS, in my case it occurs when scaling 150%. I have 13" inch notebook with FHD. mb. |
Ok let try to replicate the issue based on the information that you provided. Thanks a lot for your findings. |
Good luck! |
within your project select Add new file and add a "application manifest", add the following in the manifest file: add-inside-app-manifest-file.zip Then open your project properties, select application tab then go to the manifest section, select your newly created manifest file, close property window and rebuild solution - should fix your problem. |
Hi, within the manifest file inside assembly identity node is that the name of your application? if not input the name of your app.exe. Try - within form properties select "AutoScaleMode" change from "Font" to "DPI" see if this helps. failing that, i'll code up a sample app for all different dpi and upload it here - give me a day or so. |
Corrected. However, everything worked fine, the application without scaling on my device looks terrible and you can't miss it.
I tried.
I know how to write applications that scale well. I generally don't use MetroForm because I don't like - I only use components from MetroFramework. I just wanted to report a bug. But I appreciate the willingness. :) |
It's a solution for my 13-inch Full HD laptop. But it will probably be bad again with 12-inch Full HD etc. |
And it would be good to add scaling options to MetroForm.
|
@KamilSzymborski I still do not understand how you were able to fix the maximize and minimize boxes in the Control Box using DPI Aware. Could you elaborate on how you fixed that? |
Finally I solved this by implementing auto-scaling to the window buttons. float dpi;
using (var g = newButton.CreateGraphics())
// 96 is base /default DPI, is like 100% system scaling
dpi = (96 / Math.Max(g.DpiX, g.DpiY));
var oldButtonSize = newButton.Size;
var newButtonWidth = Convert.ToInt32(oldButtonSize.Width + (oldButtonSize.Width * dpi));
var newButtonHeight = Convert.ToInt32(oldButtonSize.Height + (oldButtonSize.Height * dpi));
newButton.Size = new Size(newButtonWidth, newButtonHeight); I am sending you MetroForm.cs - replace it in MetroFramework/Forms. |
Kamil,
Thank you very much!!! I can't express my gratitude enough, this really
helped with the issue I was dealing with.
…On Sat, Feb 20, 2021 at 12:02 AM Kamil Szymborski ***@***.***> wrote:
Finally I solved this by implementing auto-scaling to the window buttons.
float dpi;
using (var g = newButton.CreateGraphics())
dpi = (96 / Math.Max(g.DpiX, g.DpiY));
var oldButtonSize = newButton.Size;
var newButtonWidth = Convert.ToInt32(oldButtonSize.Width + (oldButtonSize.Width * dpi));var newButtonHeight = Convert.ToInt32(oldButtonSize.Height + (oldButtonSize.Height * dpi));
newButton.Size = new Size(newButtonWidth, newButtonHeight);
I am sending you *MetroForm.cs* - replace it in *MetroFramework/Forms*.
MetroForm.zip
<https://github.com/dennismagno/metroframework-modern-ui/files/6014224/MetroForm.zip>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFC3CJGHV2JHUGPQLZ6KRCTS75F7XANCNFSM4H66BC7A>
.
|
https://ibb.co/gVbzkkr
The text was updated successfully, but these errors were encountered: