// Update Mouse possition on the control
private void gMapControl_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
RngBrngMarker RB_Marker = new RngBrngMarker(gMapControl.FromLocalToLatLng(StartMousePoint.X, StartMousePoint.Y), "Test", new Font(FontFamily.GenericSansSerif, 3), Brushes.Yellow, new Point(StartMousePoint.X, StartMousePoint.Y), new Point(e.X, e.Y));
ToolsOverlay.Markers.Clear();
ToolsOverlay.Markers.Add(RB_Marker);
gMapControl.Refresh();
}
PointLatLng MouseLatLong = gMapControl.FromLocalToLatLng(e.X, e.Y);
this.labelLat_Long.Location = new Point(this.labelLat_Long.Location.X, (gMapControl.Size.Height - 4));
if (Properties.Settings.Default.DisplayPosInDecimals)
{
this.labelLat_Long.Text = MouseLatLong.Lat + " " + MouseLatLong.Lng;
}
else
{
GeoCordSystemDegMinSecUtilities.LatLongClass ToConvert = new GeoCordSystemDegMinSecUtilities.LatLongClass(MouseLatLong.Lat, MouseLatLong.Lng);
string Latitude_S, Longitude_S;
ToConvert.GetDegMinSecStringFormat(out Latitude_S, out Longitude_S);
this.labelLat_Long.Text = Latitude_S + " " + Longitude_S;
}
if (e.Button == MouseButtons.Left && isDraggingMarker && currentMarker != null)
{
PointLatLng MousePosition = gMapControl.FromLocalToLatLng(e.X, e.Y);
GPoint MarkerPositionLocal = gMapControl.FromLatLngToLocal(currentMarker.Position);
GPoint NewLabelPosition = new GPoint(MarkerPositionLocal.X - e.X, MarkerPositionLocal.Y - e.Y);
GMapTargetandLabel MyMarker = (GMapTargetandLabel)currentMarker;
MyMarker.LabelOffset = new Point(NewLabelPosition.X, NewLabelPosition.Y);
gMapControl.Refresh();
}
else if (SharedData.bool_Listen_for_Data == true)
{
bool Mouse_Not_Over_Label = 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)
{
PointLatLng MousePosition = gMapControl.FromLocalToLatLng(e.X, e.Y);
GPoint MarkerPositionLocal = gMapControl.FromLatLngToLocal(m.Position);
GPoint NewLabelPosition = new GPoint(MarkerPositionLocal.X - e.X, MarkerPositionLocal.Y - e.Y);
if (MouseIsOnTheLabel(e, m))
{
GMapTargetandLabel MyMarker = (GMapTargetandLabel)m;
MyMarker.ShowLabelBox = true;
gMapControl.Refresh();
if (ExtendedLabel.Visible)
{
Mouse_Not_Over_Label = false;
HandleExtendedLabel(MyMarker);
}
}
else
{
GMapTargetandLabel MyMarker = (GMapTargetandLabel)m;
MyMarker.ShowLabelBox = false;
}
}
if (Mouse_Not_Over_Label)
ExtendedLabel.DefaultAll();
}
}
}