private void Form1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (m_graphics_acceleration) { m_map_drag_enabled = false; m_map_drag_offset_x = 0; m_map_drag_offset_y = 0; } else { m_map_drag_enabled = false; m_map_drag_offset_x = e.X - m_map_drag_anchor_x; m_map_drag_offset_y = e.Y - m_map_drag_anchor_y; Draw(m_map_drag_graphics); if (m_map_drag_graphics != null) { m_map_drag_graphics.Dispose(); } m_map_drag_graphics = null; m_framework.Pan(-m_map_drag_offset_x, -m_map_drag_offset_y); // Simulate a navigation position if there was no drag. //if (m_map_drag_offset_x == 0 && m_map_drag_offset_y == 0) //{ // double time = (double)DateTime.Now.Ticks / 10000000.0; // int validity = (int)CartoType.ValidityFlag.Position | (int)CartoType.ValidityFlag.Time; // double[] coord = { e.X, e.Y }; // m_framework.ConvertCoords(coord,CartoType.CoordType.Screen,CartoType.CoordType.Degree); // Navigate(validity, time, coord[0], coord[1], 0, 0, 0); //} m_map_drag_offset_x = 0; m_map_drag_offset_y = 0; Invalidate(); } } // Right-click calculates a route between the last point and this point. else if (e.Button == MouseButtons.Right) { var p = new CartoType.Point(); p.X = e.X; p.Y = e.Y; m_framework.ConvertPoint(p, CartoType.CoordType.Screen, CartoType.CoordType.Degree); if (m_last_point.X != 0 && m_last_point.Y != 0) { // Delete the previous route, which consists of object IDs 0, 1, and 2. m_framework.StartNavigation(m_last_point.X, m_last_point.Y, CartoType.CoordType.Degree, p.X, p.Y, CartoType.CoordType.Degree); Invalidate(); } m_last_point.X = p.X; m_last_point.Y = p.Y; } }