public void UpdatePoint(float dx, float dy, ScreenConverter sc) { if (curPoint != null) { MyPoint cur = curPoint; if (!(sc.II(cur.X) + dx > Width - 4) && sc.II(cur.X) + dx > 0) { cur.X += sc.LR((int)dx); } if (!(sc.JJ(cur.Y) + dy > Height - 4) && sc.JJ(cur.Y) + dy > 0) { cur.Y -= sc.LR((int)dy); } curPoint.Current = false; } }
private void WorkPanel_MouseMove(object sender, MouseEventArgs e) { if (e.Button.HasFlag(MouseButtons.Left) && !last.IsEmpty) { float dx = e.Location.X - last.X; float dy = e.Location.Y - last.Y; workSpace.UpdatePoint(dx, dy, con); WorkPanel.Invalidate(); last = e.Location; } if (e.Button.HasFlag(MouseButtons.Right) && !last.IsEmpty) { float dx = e.Location.X - last.X; float dy = e.Location.Y - last.Y; con.RX -= con.LR(dx); con.RY += con.LR(dy); WorkPanel.Invalidate(); last = e.Location; } last = e.Location; }