I try to open new window in C# (WinForms) in same position each time.
Try to use this code:
private void Notification_Load(object sender, EventArgs e)
Rectangle screenSize = Screen.PrimaryScreen.Bounds; //get resolution of screen
int x = screenSize.Height -115-30; //x coordinate = resolution of screen - window Height - 30 (for taskbar)
int y = screenSize.Width - 345; //y coordinate = resolution of screen - window Weight
this.SetDisplayRectLocation(x, y); //new coordinates for form
properties of windows StartPosition =Manual
but as result - have that always my window open in the upper left corner.
try to put different value for x and y - result the same.
what i'm doing wrong?
I hope this helps
int x = Screen.PrimaryScreen.WorkingArea.Top; int y = Screen.PrimaryScreen.WorkingArea.Left; this.Location = new Point(x, y);
properties of the form
this.SetDisplayRectLocation is for setting the view location within a scrollable form: