Answer the question
In order to leave comments, you need to log in
How to dynamically calculate button position in powershell?
Good afternoon, dear ones!
I have this code:
Function Popup ($PopupMessage){
$PopupWin = New-Object System.Windows.Forms.Form
$PopupWin.StartPosition = "CenterScreen"
$PopupWin.Text = "Sending password via SMS"
$PopupWin.Width = 200
$PopupWin.Height = 120
$PopupWin.ControlBox = 0
$PopupWin.AutoSize = 1
$PopupWin.AutoSizeMode = "GrowAndShrink"
#Border style and font.
$PopupWin.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::Fixed3D
$PopupWin.Font = New-Object System.Drawing.Font("Verdana",11)
$PopupWinOKButton = New-Object System.Windows.Forms.Button
$PopupWinOKButton.add_click({ $PopupWin.Close() })
$PopupWinOKButton.Text = "Close"
$PopupWinOKButton.Size = New-Object System.Drawing.Size(90,25)
$PopupWinOKButton.Location = New-Object System.Drawing.Point(($PopupWin.Width*1),50)
$PopupLabel = New-Object System.Windows.Forms.Label
$PopupLabel.Text = $PopupMessage
$PopupLabel.AutoSize = 1
$PopupLabel.Location = New-Object System.Drawing.Point(10,10)
$PopupWin.Controls.Add($PopupLabel)
$PopupWin.Controls.Add($PopupWinOKButton)
$PopupWin.ShowDialog() | Out-Null
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question