Cleanup PS Studio code + cleanup items

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 7 years and 7 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

Cleanup PS Studio code + cleanup items

Post by stevens »

Product, version and build: latest update PS Studio
32 or 64 bit version of product: 64
Operating system: W2K12R2
32 or 64 bit OS: 64
PowerShell Version: 5

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

I would like to know if I can safely remove (empty) code which is put there by PS Studio or if it is needed (then for what?).
F.e.

$contextmenuStripComputer_Opening = [System.ComponentModel.CancelEventHandler]{
#Event Argument: $_ = [System.ComponentModel.CancelEventArgs]
#TODO: Place custom script here

}

Then also I have a picturebox ($picturebox1) which I cannot find in my design view but is there. How can I select it and make it popup so I could see the properties/dragg it if it would be out of the form (what I think is the case)?

Steven
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Cleanup PS Studio code + cleanup items

Post by davidc »

[TOPIC MOVED TO THE POWERSHELL GUIS FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
User avatar
dan.potter
Posts: 709
Last visit: Wed Nov 14, 2018 11:39 am

Re: Cleanup PS Studio code + cleanup items

Post by dan.potter »

If you are talking about the comments, it's an option in the options panel.

As for the full code block, if you delete it PS studio will ask you if you want to remove the event for it. Choose yes.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Cleanup PS Studio code + cleanup items

Post by jvierra »

On the top of the "Properties" panel is a drop down. It contains all objects on the form. Select the hidden object and it will be selected. If it is off of the form just set the location to 0,0 and it will become visible.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Cleanup PS Studio code + cleanup items

Post by jvierra »

PSSHidden.png
PSSHidden.png (24.7 KiB) Viewed 3510 times
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Re: Cleanup PS Studio code + cleanup items

Post by stevens »

Ok, thanks, that worked indeed!
When I resize the form, how can I make sure every item resizes with it?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Cleanup PS Studio code + cleanup items

Post by jvierra »

TO resize with a form a control must be able to be resized and it must be anchored.

From what you have posted it is not possible to offer more help than that.
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Re: Cleanup PS Studio code + cleanup items

Post by stevens »

dan.potter wrote:If you are talking about the comments, it's an option in the options panel.

As for the full code block, if you delete it PS studio will ask you if you want to remove the event for it. Choose yes.
My question = is it safe to say that all code which contains nothing more then "#TODO: Place custom script here" can be removed?
This topic is 7 years and 7 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