Resizable form

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 4 years and 6 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
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Resizable form

Post by stevens »

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: PS Studio, 2019, 5.6.166
32 or 64 bit version of product: 64
Operating system: W2K16
32 or 64 bit OS: 62

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

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

Hi,

I have troubles resizing a Ps Studio forms from day 1.
So let me give it another attempt here by posting an example form which I'd like to have readable on any Windows but more specifically via an Remote Desktop session.
Problem now is:
-it doesn't resize well: everything should scale, I know I can work with anchors but is that the only option?
-text size is to small, in my production version of the tool, I could set a bigger font (I guess) but then I'd have to rework the full form by hand correct?

Thanks for helping me out here.
S.
ExampleForm.psf
exampleform
(23.35 KiB) Downloaded 99 times
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Resizable form

Post by mxtrinidad »

Please check the link to help you understand how to build GUI forms for high DPI displays:
https://info.sapien.com/index.php/guis/ ... x1dGlvbiJd

Let us know if it helps!
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Resizable form

Post by Alexander Riedel »

I should probably point out that this is not "PowerShell Studio Forms" it is Microsoft Windows Forms, just as you would use in C# etc.
I am not sure would you mean by "everything should scale" because that is not how this works. I mean to some extent, yes, but not always exactly the way you think it should.

One way of doing that is to handle the Window size event and resize your control accordingly. It is of course up to you to decide what 'accordingly' means.
The Windows Forms ability to anchor controls to the window border or other controls is quite handy and prevents you from having to write a lot of code to resize controls when the window is sized.
It requires some effort to set that up, but it works well.

As for the font size, if you are creating something for a fixed size environment, you pick the font and size at design time. If your application must consider different resolutions and scaling factors, you should determine the font size dynamically on startup based on the environment your application is running in.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Re: Resizable form

Post by stevens »

Thanks. Hope to find some time some day to go deeper in to this topic.
Was hoping for a quickfix, don't have the time to figure this all out.

For now, we will have to check other alternatives then using the Powershell GUI then.
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Re: Resizable form

Post by stevens »

Are there some basics I could already improve the GUI with? If I resize the form in PS Studio, boxes get scrambled, that's my main concern. Resizing is nice to have, but not fully blocking (though font/window it is much to small to read correctly on RDS).
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Resizable form

Post by Alexander Riedel »

Send screenshots. Without knowing what you see and what you resolution is, its hard to tell.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Resizable form

Post by Alexander Riedel »

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 4 years and 6 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