user4729909
user4729909

Reputation:

Move current Form to left side of screen

I have a Windows Forms that represents a menu. If I click on an Item, I want to move the Form to the top left of the Screen and extend the window to the buttom of the screen.

Like GIMP do it. GIMP has multiple windows and 2 of them are docked left and right of the screen.

It looks like:

enter image description here

How can I do this?

Upvotes: 3

Views: 998

Answers (1)

LarsTech
LarsTech

Reputation: 81620

Using the Screen.FromControl function to determine the current screen, then set the parameters accordingly:

Rectangle r = Screen.FromControl(this).WorkingArea;
this.Bounds = new Rectangle(r.Left, 0, this.Width, r.Height);

Upvotes: 2

Related Questions