How to develop in hi-rez for low-rez

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.
Post Reply
zuluwave
Posts: 7
Joined: Mon Sep 09, 2019 10:53 am

How to develop in hi-rez for low-rez

Post by zuluwave » Mon Nov 11, 2019 12:53 pm

My Powershell development laptop screen resolution is 3840x2160 and the target laptops I am going to run the GUI apps run 1280x800 (I can't change that). I am stuck as I can't seem to shrink the screen or fonts small enough so that I can work with the form in the Designer? Please see attached.
Attachments
Raven Restore Shrink low-rez.png
Raven Restore Shrink low-rez.png (21.19 KiB) Viewed 359 times
Raven EZ Restore.png
Raven EZ Restore.png (71.04 KiB) Viewed 359 times

jvierra
Posts: 14016
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to develop in hi-rez for low-rez

Post by jvierra » Mon Nov 11, 2019 12:57 pm

For questions about the PowerShell Studio IDE please post in the PowerShell Studio Product Support forum.

zuluwave
Posts: 7
Joined: Mon Sep 09, 2019 10:53 am

Re: How to develop in hi-rez for low-rez

Post by zuluwave » Mon Nov 11, 2019 1:06 pm

On the development laptop with 3840x2160 I cut the form size in half. It shows up with a usable dimension on the target laptop of 1280x800 but as you can see, I can no longer work with it on the development side? Thanks!


zuluwave
Posts: 7
Joined: Mon Sep 09, 2019 10:53 am

Re: How to develop in hi-rez for low-rez

Post by zuluwave » Tue Nov 12, 2019 2:40 pm

The "Designing GUIs for High DPI Displays" blog is very helpful however after reading, it I am still unsure what to do! I want to scale the form, do I need to scale each control? For example;

$buttonRestore.Width = $scaledWidth = ConvertTo-ScaledPixel -Form $formRavenBackupRestore -Width 90

Other than trial and error, I am not sure how to set the -Width value?

Again I am downgrading the resolution, I am developing on a laptop with 3840x2160 and need to run the form on laptops with 1280x800 resolution. This is a restriction required by another app that runs on those 1280x800 laptops.

Another option would be to use a font size of 2 but it makes it very difficult to develop with!

Is this not a common issue almost every one has using Powershell Studio? I feel like I am missing something! Thanks!

jvierra
Posts: 14016
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to develop in hi-rez for low-rez

Post by jvierra » Tue Nov 12, 2019 3:24 pm

Scaling and hi-dpi are a bit of a classic catch-22. You can do basic scaling by enabling hi-r4ewz support. More complex scaling requires a bit of careful programming. In the early days of Windows we would build multiple forms definitions that used the same code. Now we can scale a form and display it at multiple resolution as long as we choose the components and layout carefully. We need to avoid autosize mode in many cases and should relay on thiongs like tables and panels to autolayout the controls. This will allow them to autoscale correctly. Fonts can be an issue if they are specified incorrectly.

In PowerShell I avoid this by not doing complex forms. If I need more flexible forms I do them in WPF which has better support for hi-dpi scaling and uses a better layout methodology.

You need to read the blog and try to understand what it is telling you which can be a challenge if you are not well familiarized with forms and Windows.

Start by building a new and simple form and testing in both environments. Don't worry about code just enable support and then se how controls and fonts behave.

See this video: https://www.youtube.com/watch?v=Y9FpuKVRdZc

This might be helpful: https://www.sqlshack.com/4k-resolution- ... t-visuals/

Start small and build up your form and apply adjustments as needed.

User avatar
brittneyr
Site Admin
Posts: 236
Joined: Thu Jun 01, 2017 7:20 am

Re: How to develop in hi-rez for low-rez

Post by brittneyr » Tue Nov 12, 2019 3:34 pm

You may find the following article helpful:
https://info.sapien.com/index.php/how-t ... g-controls
Brittney Ryn
SAPIEN Technologies, Inc.

zuluwave
Posts: 7
Joined: Mon Sep 09, 2019 10:53 am

Re: How to develop in hi-rez for low-rez

Post by zuluwave » Thu Nov 21, 2019 9:21 am

Thank you both jvierra and brittneyr for your responses, insight and experience! I certainly have found in working on this question an educational experience! The tool I am developing is being built to run strictly for low-rez systems. The target systems have been running low-rez for over 10 years and I have no anticipation that will change within my career. Through the guidance of my mentor, I backed off my 4k display on my development system to that off the target system. So basically I am developing using a what-I-see-is-what-they-get strategy.

After reading this blog on stack-exchange; https://stackoverflow.com/questions/227 ... i-settings, it suggests that the issue of winforms and display resolution is evolving based on the continued development of .NET/WIndows 10. Based on what version you are running under will determine how the form will react to the form properties that are set.

Thanks again!

jvierra
Posts: 14016
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to develop in hi-rez for low-rez

Post by jvierra » Thu Nov 21, 2019 10:23 am

The issue of form display size has always been an issue from 640X480 on up. In early Windows we just included multiple form templates and loaded the one matching the resolution.

In Win10 you can create a shortcut for PSS and configure it to set the target resolution. Use Windows settings to set the scaling factor. Between these it is possible to cross develop without lowering the monitor/adapter resolution.

Post Reply