views:

2886

answers:

3

I want to enable users to resize a panel at runtime by dragging a corner. Any ideas?

Thanks!

+1  A: 

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.

CodeSavvyGeek
A: 

If you want to use an actual System.Windows.Forms.Panel and have it dynamically resize, then you will have to do it like if you were doing drag-n-drop. You will have to handle the mouse Click event on the panel, determine if you are on the edge of the panel (within a 2-3 pixels) and then handle the Drag events and change the Size property of the panel.

uzbones
+2  A: 

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;
  }
Quintin Robinson