private void PanelSizer_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { iDragging = true; iLastMouseLocation = PanelSizer.PointToScreen(new Point(e.X, e.Y)); iStartSize = Size; } }
private void PanelSizer_MouseMove(object sender, MouseEventArgs e) { if (iDragging) { Point current = PanelSizer.PointToScreen(new Point(e.X, e.Y)); Point delta = new Point(current.X - iLastMouseLocation.X, current.Y - iLastMouseLocation.Y); Size = new Size(iStartSize.Width + delta.X, iStartSize.Height + delta.Y); } }