Rafraîchir une form après étirement
Bonjour, je voudrais rafraîchir une form après étirement afin que le bouton qu'elle contient conserve les proportions que je lui ai fixé initialement. Savez-vous comment faire cela, svp?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Function Button_Click()
Function Generate-Form {
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
# Build Form
$Form = New-Object System.Windows.Forms.Form
$Form.Text = "My Form"
$Form.Size = New-Object System.Drawing.Size(200,200)
$Form.StartPosition = "CenterScreen"
$Form.Topmost = $True
$ButtonLocX = $Form.Width/6
$ButtonLocY = $Form.Height/6
$ButtonX = $Form.Width/2
$ButtonY= $Form.Width/9
# Add Button
$Button = New-Object System.Windows.Forms.Button
$Button.Location = New-Object System.Drawing.Size($ButtonLocX,$ButtonLocY)
$Button.Size = New-Object System.Drawing.Size($ButtonX,$ButtonY)
$Button.Text = "Show Dialog Box"
$Form.Controls.Add($Button)
#Show the Form
$form.ShowDialog()| Out-Null
} #End Function
#Call the Function
Generate-Form |