Childform + Background Window

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.
jvierra
Posts: 14011
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Childform + Background Window

Post by jvierra » Mon Nov 02, 2015 3:20 am

I will take that back. This kind of modal window can be hidden. Just hide it before you call the child.

$form1.Visible=$false

User avatar
dan.potter
Posts: 709
Joined: Wed Oct 08, 2014 6:02 am

Re: Childform + Background Window

Post by dan.potter » Mon Nov 02, 2015 7:07 am

Turning on sta mode will get rid of the console window in the background.

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

Re: Childform + Background Window

Post by jvierra » Mon Nov 02, 2015 8:11 am

Oh. I see. The console window. All of those huge pictures are hard to figure out.

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

Re: Childform + Background Window

Post by jvierra » Mon Nov 02, 2015 8:18 am

Running a ps1 in STA mode does not hide the console.

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

Re: Childform + Background Window

Post by jvierra » Mon Nov 02, 2015 8:25 am

When building a forms project EXE be sure you are not using the command line host. Use the Windows Forms host or the Windows host.

User avatar
BlaaaBlaaaBlaaa
Posts: 10
Joined: Sat Oct 31, 2015 5:06 am

Re: Childform + Background Window

Post by BlaaaBlaaaBlaaa » Mon Nov 02, 2015 1:56 pm

jvierra wrote:When building a forms project EXE be sure you are not using the command line host. Use the Windows Forms host or the Windows host.
Hi again,

Sry for the late response but I just found some time to keep on working on my script. THANK YOU for your tipps so far. Chaning the "Platform" did the trick for me so the console does not show up. Is there any important difference between Windows Forms / Windows host that I should know about? I took Windows Forms for now which works great.

User avatar
BlaaaBlaaaBlaaa
Posts: 10
Joined: Sat Oct 31, 2015 5:06 am

Re: Childform + Background Window

Post by BlaaaBlaaaBlaaa » Mon Nov 02, 2015 2:04 pm

And regarding your second tip for hiding:

$form1.Visible=$false

That works fine as well. With this it is possible to get a "menu feeling". I will now try to get the StartPosition for the Submenus done because I was using CenterParent until now which obviously does not work when the parent is hidden.

User avatar
BlaaaBlaaaBlaaa
Posts: 10
Joined: Sat Oct 31, 2015 5:06 am

Re: Childform + Background Window

Post by BlaaaBlaaaBlaaa » Mon Nov 02, 2015 2:47 pm

Ok did not find a good way so far for the positioning of the subforms. I will look into the MDI form tomorrow.

Locked