Can someone help in understanding how to calculate the Height and Width of a Form. For Example I Created a blank Powershell form of Height 500 and Width 700 and now If want to place a Text box a little below from the top of the form what will be the height and width that I need to enter? and If I want to place a Button at middle of the Form? what will be the height and width that I need to enter? I am struggling with this calculation.
How about sharing your code you have so far?
This may help as well:
How to Build a PowerShell GUI for your Scripts
or this:
Here is my code
$mainform = New-Object System.Windows.Forms.Form
$mainform.Text = “Main Configuration Page”
$mainform.Size=New-Object System.Drawing.Size(500,700)
$mainform.StartPosition=“CenterScreen”
$subformbutton=New-Object System.Windows.Forms.Button
$subformbutton.Location = New-Object System.Drawing.Size(X,Y)
$subformbutton.Size=New-Object System.Drawing.Size(X,Y)
$subformbutton.Text=“Sub Form”
$mainform.Controls.Add($subformbutton)
I am trying to understand how to fill the X and Y Value for height and width
BTW: When you post code or sample data or console output please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance
How about trial and error? I did it just now and I’d recommend for you to start with:
$subformbutton.Location = New-Object System.Drawing.Size(350,600)
$subformbutton.Size=New-Object System.Drawing.Size(100,30)
Sure, Can you please tell me how did you come up with the value of 350, 600 is there a way to calculate this numbers that’s my question.
I started with 100,200
… looked at the result … changed it to 100,300
… looked at the result … and so on and on … trial and error.
Did you take a look at the links I posted?
Yes, I have gone through the links. Thank you so much your help