private void setResizeMod(Point mousepoint) { if (mousepoint.X >= this.Width - 5 && mousepoint.Y >= this.Height - 5) { this.Cursor = Cursors.SizeNWSE; resizemod = ReSizeMod.BottomRight; } else if (mousepoint.X >= this.Width - 5 && mousepoint.Y >= 20) { this.Cursor = Cursors.SizeWE; resizemod = ReSizeMod.Right; } else if (mousepoint.Y >= this.Height - 5) { this.Cursor = Cursors.SizeNS; resizemod = ReSizeMod.Bottom; } else { this.Cursor = Cursors.Arrow; resizemod = ReSizeMod.None; } }
private void doResize(ReSizeMod r, MouseEventArgs e) { int newwidth = this.Width += e.Location.X - mousedownPoint.X; int newheight = this.Height += e.Location.Y - mousedownPoint.Y; if (newwidth < this.MinimumSize.Width || newwidth > this.MaximumSize.Width || newheight < this.MinimumSize.Height || newheight > this.MaximumSize.Height) { blnMouseDown = false; return; } switch (r) { case ReSizeMod.BottomRight: { this.Size = new Size(newwidth, newheight); mousedownPoint = e.Location; break; } case ReSizeMod.Right: { this.Size = new Size(newwidth, this.Height); mousedownPoint = e.Location; break; } case ReSizeMod.Bottom: { this.Size = new Size(this.Width, newheight); mousedownPoint = e.Location; break; } } }