Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing a panel in C#, Windows Forms

How can I enable users to resize a panel at runtime by dragging a corner?

like image 414
Jon Avatar asked Mar 13 '26 13:03

Jon


2 Answers

You could intercept the mouse location and the click.. if it's in a corner then set a resizing boolean and then on the mousemove event you could implement something like this..

  if (_resizing)
  {
    this.Height = top + e.Y;
    this.Width = width + e.X;
  }
like image 105
Quintin Robinson Avatar answered Mar 16 '26 04:03

Quintin Robinson


I don't know about dragging corners, but you could dock the panel and use splitters to provide a place for users to resize the docked regions.

like image 26
Kevin Kibler Avatar answered Mar 16 '26 04:03

Kevin Kibler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!