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.
Locked
User avatar
stevens
Posts: 351
Joined: Wed Jun 15, 2016 2:26 am

Resizable form

Post by stevens » Tue Sep 03, 2019 3:51 am

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 13 times

User avatar
mxtrinidad
Site Admin
Posts: 359
Joined: Sun Mar 03, 2013 12:42 pm

Re: Resizable form

Post by mxtrinidad » Tue Sep 03, 2019 8:56 am

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: 7107
Joined: Tue May 29, 2007 4:43 pm

Re: Resizable form

Post by Alexander Riedel » Tue Sep 03, 2019 10:33 am

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: 351
Joined: Wed Jun 15, 2016 2:26 am

Re: Resizable form

Post by stevens » Fri Sep 06, 2019 2:57 am

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: 351
Joined: Wed Jun 15, 2016 2:26 am

Re: Resizable form

Post by stevens » Tue Sep 10, 2019 7:01 am

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: 7107
Joined: Tue May 29, 2007 4:43 pm

Re: Resizable form

Post by Alexander Riedel » Tue Sep 10, 2019 7:04 am

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: 7107
Joined: Tue May 29, 2007 4:43 pm

Re: Resizable form

Post by Alexander Riedel » Tue Sep 10, 2019 7:05 am

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.

Locked