Support Forums

We are currently experiencing failures on the SAPIEN store and are working hard to rectify the situation. In the meantime, please DO NOT place an order through the store. Instead, please contact us directly at sales@sapien.com. We apologize for any inconvenience.

Form position size...

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.
User avatar
JMS_PT
Posts: 53
Joined: Wed Dec 09, 2015 4:10 am

Form position size...

Postby JMS_PT » Sun Jan 03, 2016 7:35 am

I need to to set the Form`s position, size, etc.. when it loads
So far I can only get WindowState working using the $Form1_Shown = {} event, all others fail...

$Form1.Size.Width = $varFrmMSizeWidth
$Form1.Size.Height = $varFrmMSizeHeight
$Form1.Location.X = $varFrmMLocationX
$Form1.Location.Y = $varFrmMLocationY
$Form1.StartPosition = $varFrmMStartPosition
$Form1.WindowState = $varFrmMWindowState

These global variables are populated from an XML file when the form loads
Besides "WindowState" how to get all others working?
User avatar
JMS_PT
Posts: 53
Joined: Wed Dec 09, 2015 4:10 am

Re: Form position size...

Postby JMS_PT » Sun Jan 03, 2016 7:42 am

Ok, found the solution here
viewtopic.php?t=1751

$Form1.Size = New-Object System.Drawing.Size ($varFrmMSizeWidth, $varFrmMSizeHeight)
$Form1.Location = New-Object System.Drawing.Point($varFrmMLocationX, $varFrmMLocationY)

Thank you.
User avatar
jvierra
Posts: 10501
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Form position size...

Postby jvierra » Sun Jan 03, 2016 8:04 am

If you are using XML then you want to use strings to set values ... like this:

$form1.Size='400,600'
$form1.Location='50,100'

Also

$form1.StartPosition='CenterScreen'
User avatar
JMS_PT
Posts: 53
Joined: Wed Dec 09, 2015 4:10 am

Re: Form position size...

Postby JMS_PT » Mon Jan 11, 2016 7:53 am

Thank you.

Return to “Windows PowerShell”

Who is online

Users browsing this forum: No registered users and 1 guest