I'm trying to adapt @HansPasant's code from vb.net
to c#
. Also I want to adapt it so the winForms
starts centered in terms of top-to-bottom but to the far left of the screen in terms of left-to-right:
vb.net
from here How to set winform start position at top right? :
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
My current (bad) attempt:
private void scriptSurfer_Load(object sender,EventArgs e)
{
var scr = Screen.FromPoint(this.Location);
this.Location = New Point(scr.WorkingArea.Left - this.Width, scr.WorkingArea.Top);
this.OnLoad(e);
}