Screen text size

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

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 5 years and 11 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.
User avatar
cofense_egor
Posts: 4
Last visit: Fri Jul 13, 2018 11:24 am

Screen text size

Post by cofense_egor »

Product, version and build: PowerShell Studio 2018 v5.5.150
32 or 64 bit version of product: 64-bit
Operating system: Windows 10
32 or 64 bit OS: 64-bit

1) I created a GUI project in PSS on my laptop, everything looked great, exported to .ps1.
2) After a few days I reopened the project to adjust a typo. This time my laptop was connected to an high-resolution external monitor as primary screen with system-wide screen text size set to 150%.
3) I corrected an one-character typo in the script logic (unrelated to GUI, haven't touched GUI at all). Reexported as .ps1.
4) Upon committing to a repo, I noticed that PSS automatically updated all form element coordinates, some margins etc.
screenshot1.png
screenshot1.png (34.37 KiB) Viewed 3740 times

5) The form now looks unreadable. The previous version looked properly scaled and fine with either 100% or 150% text size.

Before:
screenshot3.png
screenshot3.png (17.87 KiB) Viewed 3740 times
After:
screenshot2.png
screenshot2.png (4.53 KiB) Viewed 3740 times
Thank you!
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Screen text size

Post by davidc »

The .NET designer renders and sizes controls depending on the current DPI.

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

If you can, please zip and load up the original psf file, so that we can attempt to recreate the issue:

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

What resolution and scaling did you have when you originally created the form?


Thank you,
David
SAPIEN Technologies, Inc.
User avatar
cofense_egor
Posts: 4
Last visit: Fri Jul 13, 2018 11:24 am

Re: Screen text size

Post by cofense_egor »

Original resolution: 1920x1080x100%
New resolution: 3840x2160x150%

Unfortunately, I clicked "save all" after making that minor change, so I no longer have the separate PSF. But I do have the original export ps1 from my repo which seems to contain some recovery regions. Not sure this is helpful, but I uploaded it. Thank you.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Screen text size

Post by davidc »

It looks like the problem are the labels themselves. If you have a label's AutoSize disabled and don't explicitly set a font, WinForms will incorrectly scale the control in a high DPI environment (Refer to the article I linked to in my previous post).

You can resolve the issue by setting AutoSize to True and left align the text or set the font of the labels.
David
SAPIEN Technologies, Inc.
User avatar
cofense_egor
Posts: 4
Last visit: Fri Jul 13, 2018 11:24 am

Re: Screen text size

Post by cofense_egor »

Thank you for your reply! I am not too concerned about the appearance. I do realize that I did not follow best practices and form elements may render incorrectly as text size changes. My real concern is that each time I connect the monitor, make a one byte change and export, PSS updates all form coordinates, adds margins etc and I end up with a huge commit. I tried to switch back from 150% to 100% and re-export and it did that again and not just for labels, but for every element.

Before (150%):
  1.     $groupbox1.Controls.Add($buttonLookup)
  2.     $groupbox1.Controls.Add($labelTicketNumber)
  3.     $groupbox1.Controls.Add($txtZendeskTicketNo)
  4.     $groupbox1.Location = '20, 18'
  5.     $groupbox1.Margin = '5, 5, 5, 5'
  6.     $groupbox1.Name = 'groupbox1'
  7.     $groupbox1.Padding = '5, 5, 5, 5'
  8.     $groupbox1.Size = '487, 83'
  9.     $groupbox1.TabIndex = 0
  10.     $groupbox1.TabStop = $False
  11.     $groupbox1.Text = 'Zendesk Lookup'
  12.     $groupbox1.UseCompatibleTextRendering = $True
After (100%):
  1.     $groupbox1.Controls.Add($buttonLookup)
  2.     $groupbox1.Controls.Add($labelTicketNumber)
  3.     $groupbox1.Controls.Add($txtZendeskTicketNo)
  4.     $groupbox1.Location = '12, 12'
  5.     $groupbox1.Name = 'groupbox1'
  6.     $groupbox1.Size = '292, 54'
  7.     $groupbox1.TabIndex = 0
  8.     $groupbox1.TabStop = $False
  9.     $groupbox1.Text = 'Zendesk Lookup'
  10.     $groupbox1.UseCompatibleTextRendering = $True
Is this expected? Can it be turned off?
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Screen text size

Post by davidc »

You will still encounter issues when running the script in high DPI settings if you don't apply the solutions I mentioned above.

When you work in the designer, the current DPI settings will affect the generated code. The generated code stores the original designer DPI information and when the script runs, the controls will scale automatically depending the running machine's DPI.
David
SAPIEN Technologies, Inc.
User avatar
cofense_egor
Posts: 4
Last visit: Fri Jul 13, 2018 11:24 am

Re: Screen text size

Post by cofense_egor »

Thank you for your help!
This topic is 5 years and 11 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.