Reputation:
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:
How can I do this?
Upvotes: 3
Views: 998
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