Resolution issues

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 3 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
disasm
Posts: 14
Last visit: Sun Jun 19, 2022 12:46 pm

Resolution issues

Post by disasm »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: Powershell studio
Operating system: Windows 10
PowerShell version(s): 2020

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM


I have a scaling issue it seems. When the exe runs on a 4k monitor, it looks great. When it runs on a desktop with a lower resolution, say, 1366x768, all the controls get wacky. Pictureboxes do not appear, controls look huge, and some of the checkboxes disappear (are hidden behind other controls). I have the form settings as not sizeable, anchor is Top, Left. Thanks!
User avatar
Alexander Riedel
Posts: 8488
Last visit: Mon Apr 15, 2024 3:28 pm
Answers: 20
Been upvoted: 37 times

Re: Resolution issues

Post by Alexander Riedel »

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.
disasm
Posts: 14
Last visit: Sun Jun 19, 2022 12:46 pm

Re: Resolution issues

Post by disasm »

Checking for an update. Thanks!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Resolution issues

Post by jvierra »

Here is a good place to start addressing your issue:

https://info.sapien.com/index.php/guis/ ... i-displays

For more detailed and complete information I recommend looking at the articles in the info-center and the videos on YouTube:

https://info.sapien.com/index.php/guis
https://info.sapien.com/
disasm
Posts: 14
Last visit: Sun Jun 19, 2022 12:46 pm

Re: Resolution issues

Post by disasm »

Thanks, I've actually already read the documentation you referenced. The issue isn't so much with the different control types, but more with the form itself. The form is huge on lower resolutions. The form is not resizable, so that presents an issue. How can I lock the size of the form regardless of the resolution? I went ahead and made all my controls have explicit fonts for now. I got the checkboxes to keep showing with the Autosize property set to True. How do I get the form to scale?

Also, to note, I am creating an exe, and I do see this in my config:

<add key="EnableWindowsFormsHighDpiAutoResizing" value="true"/>

Should this not be the solution to the issue?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Resolution issues

Post by jvierra »

There are other articles that will help you under5stand how to do that.
disasm
Posts: 14
Last visit: Sun Jun 19, 2022 12:46 pm

Re: Resolution issues

Post by disasm »

I think I'm having the opposite issue as your articles describe. The GUI was developed on a 4k monitor. When used in a lower resolution, controls get hidden behind each other. I've exhausted all my attempts to fix this. The examples your documentation shows is to dock controls but that takes up an entire side (bottom, top, right, left). Am I missing something?
User avatar
Alexander Riedel
Posts: 8488
Last visit: Mon Apr 15, 2024 3:28 pm
Answers: 20
Been upvoted: 37 times

Re: Resolution issues

Post by Alexander Riedel »

A good start is usually to post a complete description of the problem. Saying "controls get wacky" can mean a lot of things. Please keep in mind that we cannot see your screen.
So you need to post screenshots at the very least.
Windows Forms, like all UIs, can scale to an extent. The controls size and adjust to resolution changes and changes in the scaling factor. You probably know that a 4K monitor with a 100% scaling factor looks quite different than one with 200%. So the resolution alone is not always the deciding factor.
Based on your design, anchoring controls to each other, to the sides of the form and dynamically scaling by code might be the solution, but we cannot see anything.
It may also be necessary to just create two distinct versions of the form, if the differences get too large. But again, we cannot even guess what your form looks like without a screenshot.
Alexander Riedel
SAPIEN Technologies, Inc.
disasm
Posts: 14
Last visit: Sun Jun 19, 2022 12:46 pm

Re: Resolution issues

Post by disasm »

Not sure if this is helpful, but screen on the right is 4k, left is 1366x768, you can see how the window goes over to the other monitor (attached)
Attachments
Untitled.png
Untitled.png (90.73 KiB) Viewed 2094 times
User avatar
Lembasts
Posts: 406
Last visit: Mon Apr 15, 2024 3:12 pm
Has voted: 1 time
Been upvoted: 1 time

Re: Resolution issues

Post by Lembasts »

Alexander Riedel wrote: Wed Oct 21, 2020 7:26 am
Based on your design, anchoring controls to each other, to the sides of the form and dynamically scaling by code might be the solution, but we cannot see anything.
How do you anchor controls to each other - all I see is top,bottom, left, right which is only to the sides of the form?
By dynamically scaling does that mean that for every form load event you have to get the current dpi and scaling and manually adjust the size of every control on the form?
This topic is 3 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked