private void shtViewWnd_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Middle) { Point pt = new Point(e.X, e.Y); m_shtViewPort.PanViewPort(pt.X - m_referPt.X, pt.Y - m_referPt.Y); m_referPt = pt; Invalidate(); } }
private void matViewWnd_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Middle) { Point pt = new Point(e.X, e.Y); m_matViewPort.PanViewPort(pt.X - m_referPt.X, pt.Y - m_referPt.Y); m_referPt = pt; Invalidate(); } // display the current coordinate. Point2DEx currentPt = m_matViewPort.GetCursorPos(); posTextBox.Text = "x= " + currentPt.X().ToString("0.000") + ", y= " + currentPt.Y().ToString("0.000"); }