private void gMapControl_MouseDown(object sender, MouseEventArgs e) { StartMousePoint = new Point(e.X, e.Y); // Check if the user is trying to move the label If so then flag it by // setting the flag isDraggingMarker to true if (e.Button == MouseButtons.Left && SharedData.bool_Listen_for_Data == true) { GMapOverlay[] overlays = new GMapOverlay[] { DinamicOverlay }; for (int i = overlays.Length - 1; i >= 0; i--) { GMapOverlay o = overlays[i]; if (o != null && o.IsVisibile) foreach (GMapMarker m in o.Markers) if (m.IsVisible && m.IsHitTestVisible) { if (MouseIsOnTheLabel(e, m)) { currentMarker = m; isDraggingMarker = true; return; } } } } // Check if the user clicked on one of the interactive label fields. else if (e.Button == MouseButtons.Right && SharedData.bool_Listen_for_Data == true) { GMapOverlay[] overlays = new GMapOverlay[] { DinamicOverlay }; for (int i = overlays.Length - 1; i >= 0; i--) { GMapOverlay o = overlays[i]; if (o != null && o.IsVisibile) foreach (GMapMarker m in o.Markers) if (m.IsVisible && m.IsHitTestVisible) { if (MouseIsOnTheCFL(e, m)) { GMapTargetandLabel MyMarker = (GMapTargetandLabel)m; if (MyMarker.MyTargetIndex != -1) { UpdateCFL MyForm = new UpdateCFL(); MyForm.TrackToUpdate = MyMarker.MyTargetIndex; MyForm.StartPosition = FormStartPosition.Manual; Point relativeToForm = this.PointToScreen(new Point(e.X, e.Y)); if (this.checkBoxFullscreen.Checked) MyForm.Location = new Point(relativeToForm.X, relativeToForm.Y + 65); else MyForm.Location = new Point(relativeToForm.X + 140, relativeToForm.Y + 65); MyForm.Show(); } } else if (MouseIsOnTheHDG(e, m)) { GMapTargetandLabel MyMarker = (GMapTargetandLabel)m; if (MyMarker.MyTargetIndex != -1) { UpdateHDG MyForm = new UpdateHDG(); MyForm.TrackToUpdate = MyMarker.MyTargetIndex; MyForm.StartPosition = FormStartPosition.Manual; Point relativeToForm = this.PointToScreen(new Point(e.X, e.Y)); if (this.checkBoxFullscreen.Checked) MyForm.Location = new Point(relativeToForm.X, relativeToForm.Y + 65); else MyForm.Location = new Point(relativeToForm.X + 140, relativeToForm.Y + 65); MyForm.Show(); } } else if (MouseIsOnTheSPD(e, m)) { GMapTargetandLabel MyMarker = (GMapTargetandLabel)m; if (MyMarker.MyTargetIndex != -1) { UpdateSPD MyForm = new UpdateSPD(); MyForm.TrackToUpdate = MyMarker.MyTargetIndex; MyForm.StartPosition = FormStartPosition.Manual; Point relativeToForm = this.PointToScreen(new Point(e.X, e.Y)); if (this.checkBoxFullscreen.Checked) MyForm.Location = new Point(relativeToForm.X, relativeToForm.Y + 65); else MyForm.Location = new Point(relativeToForm.X + 140, relativeToForm.Y + 65); MyForm.Show(); } } else if (MouseIsOnTheAC_Symbol(e, m)) { GMapTargetandLabel MyMarker = (GMapTargetandLabel)m; if (MyMarker.MyTargetIndex != -1) { if (MyMarker.TargetToMonitor != -1) DynamicDisplayBuilder.DeactivateSEPTool(MyMarker.MyTargetIndex, MyMarker.TargetToMonitor); else if (MyMarker.TargetMonitoredBy != -1) DynamicDisplayBuilder.DeactivateSEPTool(MyMarker.TargetMonitoredBy, MyMarker.MyTargetIndex); else SEPToolStartTarget = MyMarker.MyTargetIndex; } } } } } }