A long time, did not write update their blog, today, Friday, the afternoon is not much, write it, record their latest achievements, talk to comfort yourself.
Originally already wrote an article, but csdn this website too not to give the power, cannot publish, also did not give saves. So all gone, and have to write again, affect the mood. So prepare to change a place to write a blog, here does not give the force.
But I'm going to finish it.
First, you must load the Gmap.net control first by adding a reference to load the appropriate. dll file, and don't be impatient if you can't find the Gmapcontrol control in the Toolbox.
Click "Tools" and select "Choose Toolbox Items", from the "Net Framework Control" in this column can find Gmapcontrol this control, load on it.
After that, drag the control to your dialog box, double-click the control, and enter its initialization function.
private void Gmapcontrol1_load (object sender, EventArgs e) {this.gMapControl1.BackColor = color.red;
Set the management mode of the control This.gMapControl1.Manager.Mode = Accessmode.serverandcache;
Sets the map source that the control displays this.gMapControl1.MapProvider = Gmapproviders.googlechinamap; Sets the current center position of the control display//31.7543, 121.6281 this.gMapControl1.Position = new Pointlatlng (45.7543, 126.6281
);
Sets the maximum scaling ratio of the control this.gMapControl1.MaxZoom = 18;
Sets the minimum scaling ratio of the control This.gMapControl1.MinZoom = 8;
Sets the current zoom scale of the control this.gMapControl1.Zoom = 13;
Create a new layer routes = Gmapoverlay (This.gmapcontrol1, "routes");
Mymark = new Gmapoverlay (this.gmapcontrol1, "Mymark"); Routes.
Isvisibile = true;//can display mymark.isvisibile = true; THIS.GMAPCONTROL1.OVERLAYS.ADD (routes);//Add to This.gMapControl1.Overlays in the layer list.ADD (Mymark);
Create an icon gmapmarker Gmapmarker = new gmapmarkergooglered (this.gMapControl1.Position);
Add layer Routes Gmapmarker.tooltiptext = "My Store"; This.
MYMARK.MARKERS.ADD (Gmapmarker); Create icon Red Cross this.
Center = new Gmapmarkercross (this.gMapControl1.Position);
THIS.ROUTES.MARKERS.ADD (Center);
This.gMapControl1.MouseMove + = new MouseEventHandler (gmapcontrol1_mousemove); This.gMapControl1.Dock = dockstyle.fill;//to display the control in full screen}
The head of the Forms class
Public partial class Form1:
Form {
Public gmapoverlay routes;
Public Gmapoverlay Mymark;
Public Gmapmarker Myshop;
Public Gmapmarker Center;
Public pointlatlng lastposition;
Public Form1 ()
{
InitializeComponent ();
}
Then compile and execute, and you will see the effect.
Everyone can see the map at this time, the following we in-depth study of this control, really useful, I will put the source code hanging on, for your reference