private void graphicsBox_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.X > tabControl.Width || e.Y > tabControl.Height - 20) { graphicsBox.BringToFront(); graphicsBox.Refresh(); } PointD pt = convertClientToSrc(e.X, e.Y);; double azimuth = Math.Asin(2 * pt.Y / (1 + pt.X * pt.X + pt.Y * pt.Y)); double tilt = (Math.Cos(azimuth) != 0) ? Math.Asin(2 * pt.X / (1 + pt.X * pt.X + pt.Y * pt.Y) / Math.Cos(azimuth)) : 0; labelXpos.Text = "Tilt X: " + (azimuth / Math.PI * 180).ToString("f3") + "°"; labelYpos.Text = "Tilt Y: " + (tilt / Math.PI * 180).ToString("f3") + "°"; //真ん中ボタンが押されながらマウスが動いたとき if (e.Button == MouseButtons.Middle) { centerPt += new PointD((lastMousePositionClient.X - e.X) / mag, (-lastMousePositionClient.Y + e.Y) / mag); Draw(); } //左ボタンが押されながらマウスが動いたとき if (e.Button == MouseButtons.Left) { if (formMain.YusaGonioMode) { formMain.YusaGonioMode = false; setVector(); } if ((e.X - graphicsBox.ClientSize.Width / 2) * (e.X - graphicsBox.ClientSize.Width / 2) + (e.Y - graphicsBox.ClientSize.Height / 2) * (e.Y - graphicsBox.ClientSize.Height / 2) < Math.Min(graphicsBox.ClientSize.Width, graphicsBox.ClientSize.Height) * Math.Min(graphicsBox.ClientSize.Width, graphicsBox.ClientSize.Height) * 0.18) { formMain.Rotate((-pt.Y + lastMousePositionSrc.Y, pt.X - lastMousePositionSrc.X, 0), Vector3D.AngleBetStereoNetPoints(pt, lastMousePositionSrc)); } else { formMain.Rotate((0, 0, 1), Math.Atan2(lastMousePositionSrc.X, lastMousePositionSrc.Y) - Math.Atan2(pt.X, pt.Y)); } //if(lastMousePositionSrc.X != pt.X || lastMousePositionSrc.Y!=pt.Y) // Draw(); } if (e.Button == MouseButtons.Right && MouseRangingMode) { MouseRangeEnd = new Point(e.X, e.Y); Draw(); } lastMousePositionSrc = pt; lastMousePositionClient = new Point(e.X, e.Y); }