1

I have a form with it's FormBorderStyle set to Sizable. This creates the grip in the bottom right. The only way to resize the window is to get your mouse right exactly on the edge. I'm wondering if there is a way to change the cursor to be able to resize when the user mouses over the grip, or if I can increase the range at which it will allow you to resize on the edge so that you don't have to be so precise with your mouse location.

ReddShepherd
  • 467
  • 1
  • 11
  • 24
  • To change the grip size, you'll have to basically chrome your own windows. Its a pain the butt, but if you want to go down this route, look at this [SO Question](http://stackoverflow.com/questions/2575216/resize-winform-with-no-border). Notice in the accepted answer, he defines a `cGrip` variable to change the grip size. – Icemanind May 29 '15 at 16:29
  • I think this is going to work for me. It's a little different since I do have a border. If you want to post it as an answer, I'll accept it once I've worked through it. Thank you for the response. – ReddShepherd May 29 '15 at 16:41

2 Answers2

1

try this

yourObject.Cursor = Cursors.SizeAll;

More on this site: MSDN

H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
1

Here is a link to a similar SO question. This guy has no borders, so you may have to do it a little differently, but should give you a direction to go in. I will repaste his code here for completion:

  public partial class Form1 : Form {
    public Form1() {
      InitializeComponent();
      this.FormBorderStyle = FormBorderStyle.None;
      this.DoubleBuffered = true;
      this.SetStyle(ControlStyles.ResizeRedraw, true);
    }
    private const int cGrip = 16;      // Grip size
    private const int cCaption = 32;   // Caption bar height;

    protected override void OnPaint(PaintEventArgs e) {
      Rectangle rc = new Rectangle(this.ClientSize.Width - cGrip, this.ClientSize.Height - cGrip, cGrip, cGrip);
      ControlPaint.DrawSizeGrip(e.Graphics, this.BackColor, rc);
      rc = new Rectangle(0, 0, this.ClientSize.Width, cCaption);
      e.Graphics.FillRectangle(Brushes.DarkBlue, rc);
    }

    protected override void WndProc(ref Message m) {
      if (m.Msg == 0x84) {  // Trap WM_NCHITTEST
        Point pos = new Point(m.LParam.ToInt32() & 0xffff, m.LParam.ToInt32() >> 16);
        pos = this.PointToClient(pos);
        if (pos.Y < cCaption) {
          m.Result = (IntPtr)2;  // HTCAPTION
          return;
        }
        if (pos.X >= this.ClientSize.Width - cGrip && pos.Y >= this.ClientSize.Height - cGrip) {
          m.Result = (IntPtr)17; // HTBOTTOMRIGHT
          return;
        }
      }
      base.WndProc(ref m);
    }
  }
Community
  • 1
  • 1
Icemanind
  • 47,519
  • 50
  • 171
  • 296