预览
代码
手机端效果
demoMapView.cs
demoMapView.Designer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
using Smobiler.Plugins;
namespace Smobiler.Tutorials.Plugins
{
partial class demoMapView : Smobiler.Core.Controls.MobileForm
{
public demoMapView() : base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void mapView1_TagClick(object sender, Smobiler.Plugins.MapViewTagClickEventArgs e)
{
Toast("Press");
}
private void button1_Press(object sender, EventArgs e)
{
gps1.GetGps();
}
private void gps1_GotLocation(object sender, GPSResultArgs e)
{ //mapview1.GeoType 若是设置BD09,则要使用e.ToBD09().Latitude
double latitude =e.ToGCJ02().Latitude;
double longitude =e.ToGCJ02().Longitude;
mapView1.Tags.Add(new Smobiler.Plugins.MapViewTag(longitude, latitude, e.Location));
}
private void button2_Press(object sender, EventArgs e)
{
MapViewRoute route = new MapViewRoute();
route.Point.Add(new MapViewPoint(121.499718, 31.239703, "上海东方明珠"));
mapView1.Routes.Add(route);
MapViewRoute route1 = new MapViewRoute();
route1.Point.Add(new MapViewPoint(121.501909, 31.240777, "海洋馆"));
mapView1.Routes.Add(route1);
MapViewRoute route2 = new MapViewRoute();
route2.Point.Add(new MapViewPoint(121.214778, 31.09607, "上海欢乐谷"));
mapView1.Routes.Add(route2);
MapViewRoute route3 = new MapViewRoute();
route3.Point.Add(new MapViewPoint(121.667003, 31.141447, "上海迪士尼度假区"));
mapView1.Routes.Add(route3);
MapViewRoute route4 = new MapViewRoute();
route4.Point.Add(new MapViewPoint(121.372423, 31.138893, "水上乐园"));
mapView1.Routes.Add(route4);
MapViewRoute route5 = new MapViewRoute();
route5.Point.Add(new MapViewPoint(121.196632, 31.094513, "上海佘山森林公园"));
mapView1.Routes.Add(route5);
MapViewRoute route6 = new MapViewRoute();
route6.Point.Add(new MapViewPoint(121.444345, 31.147221, "上海植物园"));
mapView1.Routes.Add(route6);
}
private void button3_Press(object sender, EventArgs e)
{
mapView1.Routes.Clear();
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Plugins
{
partial class demoMapView : Smobiler.Core.Controls.MobileForm
{
#region "SmobilerForm generated code "
//SmobilerForm overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerForm
//It can be modified using the SmobilerForm.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.title1 = new Smobiler.Core.Controls.Title();
this.panel1 = new Smobiler.Core.Controls.Panel();
this.panel2 = new Smobiler.Core.Controls.Panel();
this.labContent = new Smobiler.Core.Controls.Label();
this.labTitle = new Smobiler.Core.Controls.Label();
this.mapView1 = new Smobiler.Plugins.MapView();
this.gps1 = new Smobiler.Core.Controls.GPS();
this.button1 = new Smobiler.Core.Controls.Button();
this.button2 = new Smobiler.Core.Controls.Button();
this.button3 = new Smobiler.Core.Controls.Button();
//
// title1
//
this.title1.ImageType = Smobiler.Core.Controls.ImageEx.ImageStyle.FontIcon;
this.title1.Name = "title1";
this.title1.ResourceID = "angle-left";
this.title1.Size = new System.Drawing.Size(300, 30);
this.title1.Text = "MapView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel2});
this.panel1.Flex = 1;
this.panel1.Name = "panel1";
this.panel1.Scrollable = true;
this.panel1.Size = new System.Drawing.Size(0, 100);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Border = new Smobiler.Core.Controls.Border(1F);
this.panel2.BorderColor = System.Drawing.Color.Silver;
this.panel2.BorderRadius = 5;
this.panel2.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.labContent,
this.labTitle,
this.mapView1,
this.button1,
this.button2,
this.button3});
this.panel2.Location = new System.Drawing.Point(5, 9);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(290, 570);
//
// labContent
//
this.labContent.BackColor = System.Drawing.Color.WhiteSmoke;
this.labContent.FontSize = 15F;
this.labContent.Location = new System.Drawing.Point(0, 26);
this.labContent.Name = "labContent";
this.labContent.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labContent.Size = new System.Drawing.Size(290, 72);
this.labContent.Text = "GeoType设置坐标系类型 \r\nTagNavigation属性设置true时可点击Tag描述内容提示跳转导航app\r\n";
//
// labTitle
//
this.labTitle.BackColor = System.Drawing.Color.WhiteSmoke;
this.labTitle.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.labTitle.BorderColor = System.Drawing.Color.DarkSeaGreen;
this.labTitle.FontSize = 16F;
this.labTitle.Name = "labTitle";
this.labTitle.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labTitle.Size = new System.Drawing.Size(290, 26);
this.labTitle.Text = "不同样式的下拉列表控件";
//
// mapView1
//
this.mapView1.Location = new System.Drawing.Point(13, 113);
this.mapView1.Name = "mapView1";
this.mapView1.Size = new System.Drawing.Size(263, 285);
this.mapView1.TagNavigation = true;
this.mapView1.TagClick += new Smobiler.Plugins.MapViewTagClickEventHandler(this.mapView1_TagClick);
//
// gps1
//
this.gps1.Name = "gps1";
this.gps1.RequestLocation = true;
this.gps1.GotLocation += new Smobiler.Core.Controls.GpsCallBackHandler(this.gps1_GotLocation);
//
// button1
//
this.button1.Location = new System.Drawing.Point(27, 421);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 30);
this.button1.Text = "定位";
this.button1.Press += new System.EventHandler(this.button1_Press);
//
// button2
//
this.button2.Location = new System.Drawing.Point(158, 421);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 30);
this.button2.Text = "显示轨迹";
this.button2.Press += new System.EventHandler(this.button2_Press);
//
// button3
//
this.button3.Location = new System.Drawing.Point(86, 471);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(100, 30);
this.button3.Text = "清除轨迹";
this.button3.Press += new System.EventHandler(this.button3_Press);
//
// demoMapView
//
this.Components.AddRange(new Smobiler.Core.Controls.MobileComponent[] {
this.gps1});
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Name = "demoMapView";
}
#endregion
private Core.Controls.Title title1;
private Core.Controls.Panel panel1;
private Core.Controls.Panel panel2;
private Core.Controls.Label labContent;
private Core.Controls.Label labTitle;
private Smobiler.Plugins.MapView mapView1;
private Core.Controls.GPS gps1;
private Core.Controls.Button button1;
private Core.Controls.Button button2;
private Core.Controls.Button button3;
}
}