示例#1
0
        private void panelImage_MouseDown(object sender, MouseEventArgs e)
        {
            buttonSetAnchorPoint.BackColor = SystemColors.Control;
            AddAnchorMode = false;

            if (MapImageRect.Contains(e.Location))
            {
                DlgSelectLocation dlg3 = new DlgSelectLocation();

                if (dlg3.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }

                GCMapAnchor ma = new GCMapAnchor();
                ma.Location  = dlg3.SelectedLocation.Title;
                ma.Longitude = dlg3.SelectedLocation.Longitude;
                ma.Latitude  = dlg3.SelectedLocation.Latitude;
                ma.relX      = (double)(e.X - MapImageRect.X) / MapImageRect.Width;
                ma.relY      = (double)(e.Y - MapImageRect.Y) / MapImageRect.Height;

                SelectedMap.AnchorPoints.Add(ma);

                SelectedMap.RecalculateDimensions();

                panelImage.Invalidate();
                buttonSelect.Enabled = SelectedMap.MapUsable;
            }
        }