Old Project Skewed when opened on HIGH DPI LCD

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.
Locked
User avatar
bgleason
Posts: 24
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Mon Jul 14, 2014 1:35 pm

Old Project Skewed when opened on HIGH DPI LCD

Post by bgleason »

Product, version and build: PowerShell Studio 2017 v5.4.145
32 or 64 bit version of product: 64bit
Operating system: Windows 10 (x64) 10.0.15063.786
32 or 64 bit OS: 64bit

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

I have a form project that was originally created on a standard 1080p machine. I added the necessary adjustments in order for it to scale appropriately on a HIGH DPI display as in the following article: https://info.sapien.com/index.php/guis/ ... i-displays

Everything was fine... v1.0.0.1 (20170927) was compiled with no issues and executed great on std and 4k devices.

*Jeopardy music plays as time passes* Now I have a 4k monitor myself on MY machine.

I needed to open the project again and add some minor changes to it, so I opened the project made the modifications and compiled v1.0.0.2 (20180110), still everything was/looked fine. I then, out of wanting to change/check on some things, decided to reopen the project to look at the code. Now my form in the designer is all jacked up, scaling wise. I have tried readjusting my scaling/resolution on my laptop to see if that was the issue with no luck as to have it correct the form. For kicks and grins I tried recompiling, which is code unchanged from the compiled version of v1.0.0.2, and even the new compiled output is all skewed, I did go into deploy settings and up the version so it didnt overwrite the v1.0.0.2 exe. So it appears that an originally coded on Std DPI device, reopened on 4k device and saving is changing something in the PSS form control code as displayed in the PSS designer. I dont have the code/files version controlled, but I do have the EXEs which I know you guys should be able to extract/recover the original code from. From what I can tell, this appears to be a bug since I changed NOTHING in the project with regards to the form scaling...

v1.0.0.1/v1.0.0.2 output:
https://pasteboard.co/H32TJYE.png

v1.0.0.3 output, with no code changes from v1.0.0.2:
https://pasteboard.co/H32UwS7.png

Thanks...

User avatar
Alexander Riedel
Posts: 7265
Joined: Tue May 29, 2007 4:43 pm

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by Alexander Riedel »

We have received your uploaded file. I do not know yet if we can extract anything from that, that depends on what setting you used for packaging. We can only urge to really employ a version control system for your code.
<Plug> VersionRecall works great and submits automatically </Plug> ;-)

I am also moving this post to the PowerShell GUI area, as DPI issues are pretty common and I am sure someone has advice regarding this.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
bgleason
Posts: 24
Joined: Mon Jul 14, 2014 1:35 pm

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by bgleason »

This is not a powershell GUI issue.. I think you are missing the explanation... INSIDE Powershell Studio, my form was altered and scaled incorrectly when I opened on a system that had a 4K monitor and I DID NOT change it...

Re.
1. Open Powershell Studio
2. Open prior Project
3. view form on the design tab
4. get angry as my form has been scaled incorrectly

This issue is totally agnostic of the compile/build and is INSIDE the PsS Interface, so no, it was in the correct place in the PS Studio forums.

My compiled/built form is not the issue... That is fixable and can take care of that myself... The fact the PsS IDE changed it is unacceptable..

Note: the only reason I uploaded the files is so you could see that the mainform.psf was not modified between the v1.0.0.2 and v1.0.0.3 version, but somehow the form is displayed incorrectly...

User avatar
Alexander Riedel
Posts: 7265
Joined: Tue May 29, 2007 4:43 pm

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by Alexander Riedel »

First of all, please don't shoot the messenger. The base of the GUI designer is inside the .NET framework, which is done by Microsoft. They scale that stuff as they do scale the rest of the Windows UI. If you need to be mad at someone, be mad at them. It seems there is a consensus to edit forms always at 96 dpi. There is a link somewhere, we will be looking for that again.

When you change your development environment, be it OS version, display, resolution etc, things go out of whack. For us C++ and C# developers that is the same way. It's part of the job. We get the same funny scaling issues as you do. Which is ALSO why we employ a version control system. The diff tools make it much easier to detect what was changed and revert the changes if necessary.
All of that being said, I talked to the SPS team if there is anything that can be done about this.
They need you to provide the PSF file for examination. Please upload here or at the support upload.
Alexander Riedel
SAPIEN Technologies, Inc.

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

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by jvierra »

Also it might be useful to create a new account and try the form from that account. Making changes to the theme and display settings can mess up some adapters and drivers.

The display reports to the OS are done through the drivers. They know what the display is. Changes we make to the UI and theme override the defaults. Some adapter settings will not work correctly. I know from Alex's C++/C# etc. development woes when we updated from 800/600 to the new "hi-res" of that day.

In some cases some adapters will not work with GUI development tools. You might also check the vendors site for both adapter and monitor for any updates.

These items are only the tip of the iceberg as to what can effect the development mode of forms. Alex is right and he will need to have both copies of the PSF.

In my experience even with no changes to the code and you will see this. I suspect your issue is not really a big deal but needs to be troubleshot a step at a time.

User avatar
bgleason
Posts: 24
Joined: Mon Jul 14, 2014 1:35 pm

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by bgleason »

It just did it again... From the crunched display in the mainform.psf designer, I rescaled the form manually on the 15th and had it all set, recompiled/built the project and the output was fine... Opened up the project in PsS again today and now the form is stretched like something is over compensating for the form scaling.. It is getting to the point that I cant trust form creation in PsS, which is the main reason that I purchase the PsS, because I never know what form scaling I am going to get when I go back to rework a form...

I am going to try to run through some scenarios and see if I can isolate the scaling issue with how the PsS is launched...

New example image
(left) designer with over scaled form now
(right) actual app executed with last known correct scaling
that is executed same time designer is open and placed side by side for the screen capture... If I built right now, the new exe will be scaled at the size in the designer...
https://pasteboard.co/H3nnW7I1.png

User avatar
bgleason
Posts: 24
Joined: Mon Jul 14, 2014 1:35 pm

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by bgleason »

Setting the scaling on the primary monitor of a multi monitor setup is causing the PsS form designer scaling issue to occur, may be affected on single monitor as well, just dont have that setup... For ex. I have a 3 monitor setup. When I modified the scaling of either of my extended monitors, it did not impact the scaling on the form inside PsS form designer. When I modified the scaling of the primary monitor it did.

What I had to do was go into the properties of the PsS shortcut, Compatibility tab, and set the option, "Override high DPI scaling behavior ...". I had to set it to one of the "System" options, in my case I used "System (enhanced)", setting Application didnt seem to have any affect. If you have questions on the differences between system and system enhanced, you can look here: https://blogs.windows.com/buildingapps/ ... rs-update/

SAPIEN, you may want to put a warning when launching PsS and detecting a high DPI environment with non optimal settings, just a recommendation.. And since this is not a built/compiled form issue, I recommend that this topic be sent back to the PsS forum and not the Powershell GUIs forum, since it is the inner workings of the application interface...

Thanks...

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

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by jvierra »

It seems that what you are saying is that, with multiple monitors, the scaling is always set to the primary and not to the monitor that you are currently using.

This may be an issue wit PSS. I would post a request here: https://www.sapien.com/requests
since it will get on the update schedule. I don't see this as a bug as much as it is an oversight since PSS seems to never address use with multiple monitors.

By the way... good work tracking this down. I would never have guessed you were using multiple monitors. From the images it is clear that the desktop and theme settings area affected dramatically by the hi-dpi setting. If I had a 4k and adapter I would test to see how this is able to do this. I am sure the techs at Sapien will be able to use the info.

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

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by jvierra »

Here is somebackground on hi-dpi issues with Windows and for developers.

https://blogs.windows.com/buildingapps/ ... rs-update/

https://www.howtogeek.com/175664/how-to ... rry-fonts/

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Old Project Skewed when opened on HIGH DPI LCD

Post by davidc »

We are trying to reproduce this on our end and it would be of great assistance if you can list the exact steps you take to reproduce the issue.

Other factors in the form itself can also affects the scaling. If you can, please upload the psf file with the scaling issue:

https://www.sapien.com/support/upload

The .NET Forms designer uses DPI for scaling and sizing. The method of scaling is determined by the Form's AutoSaleMode property and any changed to the default could lead to problems. In addition, not anchoring or docking the controls could also lead to potential problems.
Note: It is not recommended to change the scale in the middle of editing the Form, which could lead to potential issues
David
SAPIEN Technologies, Inc.

Locked