How to set winform
start position at top right? I mean when user click (start) my winform application the winform will appear at the top right of the screen?
Use the Load event to change the position, the earliest you'll know the actual size of the window after user preferences and automatic scaling are applied:
Public Class Form1
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
Dim scr = Screen.FromPoint(Me.Location)
Me.Location = New Point(scr.WorkingArea.Right - Me.Width, scr.WorkingArea.Top)
MyBase.OnLoad(e)
End Sub
End Class
You can use Form.Location to set the location to a Point that represents the top left corner of the form.
So if you set this to 'Screenwidth - Formwidth' you can position the Form in the top right. To get the screen width you can use the Screen.Bounds property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With