示例#1
0
        public MainForm()
        {
            InitializeComponent();
            gmap         = new GMapControl();
            gmap.MaxZoom = 12;
            gmap.MinZoom = 1;
            this.Controls.Add(gmap);
            gmap.BringToFront();

            gmap.MapProvider = GMapProviders.OpenStreetMap;
            gmap.MinZoom     = 2;
            gmap.MaxZoom     = 100;
            depth            = 0;
            overlay          = new GMapOverlay();
            gmap.Overlays.Add(overlay);
            //  labels = new List<Label>();
            gmap.Dock       = DockStyle.Fill;
            FormBorderStyle = FormBorderStyle.FixedSingle;
            markers         = new Dictionary <int, GMapMarker>();

            //showMap();
            Size size;


            gmap.OnMarkerClick += marker_Click;

            gmap.DisableFocusOnMouseEnter = true;
            // offsets
            // gmap.OnMarkerEnter += markermouseover;
            //  panel1.BackgroundImageLayout = ImageLayout.Center;
            defaultzoom = zoom.ToString();
            Console.WriteLine(defaultx + defaulty);
            // address = "https://maps.googleapis.com/maps/api/staticmap?center="+lat.ToString()+","+lng.ToString()+"&zoom=" + defaultzoom+"&scale=1"+"&size="+defaultx+"x"+defaulty+"&key="+key;
            // panel1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseClick);
            gmap.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseClick);
            //gmap.Position = new PointLatLng(lat,lng);
            gmap.SetPositionByKeywords("Sydney, Australia");
            gmap.Zoom = zoom;
            // panel1.MouseWheel+=mousewheel;
            // this.MouseWheel += mousewheel;
            // pictureBox1.MouseClick+=new System.Windows.Forms.MouseEventHandler(this.panel1_MouseClick);
            showMap();
            loadXMLThings();
            // form2.Parent = this;
            panel1.BringToFront();
        }