private void PictureBox_MouseMove(object sender, MouseEventArgs e) { // Update pixel value label float val = PictureBox.GetValue(new Vec2(e.Location)); string valstr; if (float.IsNaN(val)) { valstr = "No value"; } else { valstr = val.ToString(); } Vec2 picPos = PictureBox.ScreenToPicture(new Vec2(e.Location)); if (PictureBox.Zoom != 1) { labelPixelValue.Text = $"({picPos.X:F2}, {picPos.Y:F2}): {valstr}"; } else { labelPixelValue.Text = $"({picPos.X:F0}, {picPos.Y:F0}): {valstr}"; } if (PanStartMousePosition != Point.Empty) { // Pan image Vec2 delta = (new Vec2(e.Location) - new Vec2(PanStartMousePosition)) / Zoom; PictureBox.PicturePosition = (new Vec2(PanStartPicturePosition) - delta).ToPointF(); UpdateUI(); } else if (ActiveAnnotation != null && e.Button == MouseButtons.Left) { if (ActiveControlPoint >= 0) { // Move control point Vec3 pos = new Vec3(PictureBox.ScreenToPicture(new Vec2(e.Location)), PictureBox.Slice); ActiveAnnotation.ControlPoints[ActiveControlPoint] = pos; } else { // Move all control points Vec3 delta = new Vec3(PictureBox.ScreenToPicture(new Vec2(e.Location)), PictureBox.Slice) - controlPointSelectLocation; for (int n = 0; n < ActiveAnnotation.ControlPoints.Count; n++) { ActiveAnnotation.ControlPoints[n] = oldControlPointLocations[n] + delta; } } Refresh(); UpdateProfile(); } }