Here is a Microsoft example that is the first example that comes up when using a search engine with a good questiuon:
"winforms set form location"
You can use that question to get more examples.
Have form in right bottom corner?
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.
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.
Re: Have form in right bottom corner?
Here is a simple question that will get numerous examples of how to set the screen location of a form:
https://social.technet.microsoft.com/Fo ... powershell
Just add "powershell" to the beginning of the previous search question to get PowerShell answer first.
Like this: "powershell winforms set form location"
https://social.technet.microsoft.com/Fo ... powershell
Just add "powershell" to the beginning of the previous search question to get PowerShell answer first.
Like this: "powershell winforms set form location"
Re: Have form in right bottom corner?
Here, I threw this together quickly. It should work.
- $form1_Load = {
- $x = [system.windows.forms.screen]::PrimaryScreen.Bounds.Width - $form1.Bounds.Width
- $y = [system.windows.forms.screen]::PrimaryScreen.Bounds.Height - $form1.Bounds.Height
- $form1.Location = [System.drawing.point]::New($x, $y)
- }
Re: Have form in right bottom corner?
Almost there. Found this and this code works
$monitor = [System.Windows.Forms.Screen]::PrimaryScreen
$widthFactor = 0.77
#$heightFactor = 0.0333333333333333
$heightFactor = 0.62
$formChatBot.Location = New-Object System.Drawing.Point(($monitor.WorkingArea.Width * $widthFactor), ($monitor.WorkingArea.Height * $heightFactor))
$monitor = [System.Windows.Forms.Screen]::PrimaryScreen
$widthFactor = 0.77
#$heightFactor = 0.0333333333333333
$heightFactor = 0.62
$formChatBot.Location = New-Object System.Drawing.Point(($monitor.WorkingArea.Width * $widthFactor), ($monitor.WorkingArea.Height * $heightFactor))
Re: Have form in right bottom corner?
Almost there. Found this and this: viewtopic.php?t=15365
The code works
$monitor = [System.Windows.Forms.Screen]::PrimaryScreen
$widthFactor = 0.77
#$heightFactor = 0.0333333333333333
$heightFactor = 0.62
$MyForm.Location = New-Object System.Drawing.Point(($monitor.WorkingArea.Width * $widthFactor), ($monitor.WorkingArea.Height * $heightFactor))
On a smaller screen it is in the right bottom corner, still visible (the form), but only half of it. If I change the widthfactor it doesn't seem to do much.
Any suggestions?
The code works
$monitor = [System.Windows.Forms.Screen]::PrimaryScreen
$widthFactor = 0.77
#$heightFactor = 0.0333333333333333
$heightFactor = 0.62
$MyForm.Location = New-Object System.Drawing.Point(($monitor.WorkingArea.Width * $widthFactor), ($monitor.WorkingArea.Height * $heightFactor))
On a smaller screen it is in the right bottom corner, still visible (the form), but only half of it. If I change the widthfactor it doesn't seem to do much.
Any suggestions?
Re: Have form in right bottom corner?
Thanks. Works fine now, only thing is that I did have to add -20
$x = [system.windows.forms.screen]::PrimaryScreen.Bounds.Width - $formChatBot.Bounds.Width
$y = [system.windows.forms.screen]::PrimaryScreen.Bounds.Height - $formChatBot.Bounds.Height
$formChatBot.Location = [System.drawing.point]::New($x, $y - 50)
The form: viewtopic.php?t=15842
$x = [system.windows.forms.screen]::PrimaryScreen.Bounds.Width - $formChatBot.Bounds.Width
$y = [system.windows.forms.screen]::PrimaryScreen.Bounds.Height - $formChatBot.Bounds.Height
$formChatBot.Location = [System.drawing.point]::New($x, $y - 50)
The form: viewtopic.php?t=15842