/// <summary> /// /// </summary> private void GetDrawRegionRect() { PointF leftUpPot = TransformMatrix.GetMousePoint(0, 0); PointF reightDownPot = TransformMatrix.GetMousePoint(this.Width, this.Height); drawRegionRect = new RectangleF(leftUpPot.X, reightDownPot.Y, Math.Abs(reightDownPot.X - leftUpPot.X), Math.Abs(leftUpPot.Y - reightDownPot.Y)); }
/// <summary> /// 重写鼠标移动 /// </summary> /// <param name="e"></param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); GetDrawRegionRect(); MouseShape.MousePoint = TransformMatrix.GetMousePoint(e.X, e.Y); MouseShape.HitRect = new RectangleF(MouseShape.MousePoint.X - 3.5f / globalZoomNum, MouseShape.MousePoint.Y - 3.5f / globalZoomNum, 7 / globalZoomNum, 7 / globalZoomNum); //SnapPointShape.SnapHitRect = new RectangleF(MouseShape.MousePoint.X - 7 / globalZoomNum, MouseShape.MousePoint.Y - 7 / globalZoomNum, 14 / globalZoomNum, 14 / globalZoomNum); if (e.Button == MouseButtons.Middle) { MouseShape.MStyle = MouseStyle.None; Matrix x = new Matrix(1, 0, 0, 1, MouseShape.MousePoint.X - MouseShape.OldMouse.X, MouseShape.MousePoint.Y - MouseShape.OldMouse.Y); TransformMatrix.initMatrix.Multiply(x, MatrixOrder.Prepend); } DrawShap(); }