📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
namespace SimpleMapViewer_2003
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.OpenFileDialog openFileDialog;
private GpsViewNET.Map map1 = null;
private GpsViewNET.MapShapeFile mapShapeFile;
private GpsShapeNET.ShapeFile shapeFile = null;
private GpsViewNET.Point m_pointFirst = null;
private MainMenu mainMenu1;
private MenuItem menuItem1;
private MenuItem menuItem2;
private MenuItem menuItem3;
private TabControl tabControl1;
private TabPage mapView;
private Label statusBar;
private TabPage detailsView;
private MenuItem menuItem_exit;
private MenuItem menuItem7;
private MenuItem menuItem_loadDataSet;
private MenuItem menuItem6;
private GpsViewNET.Point m_pointLast = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
// set license key - you can get this from www.franson.com/gpstools
GpsToolsNET.License license = new GpsToolsNET.License();
license.LicenseKey = "AD05ADED8B62EF9A8A7E";
// Create a new Map
map1 = new GpsViewNET.Map();
map1.Parent = mapView;
map1.Zoom = 1.0;
map1.Location = new System.Drawing.Point(0, 0);
map1.Size = new Size(240, 296);
map1.UpdateInterval = 200;
map1.BackColor = Color.FromArgb(0, 0, 0);
map1.OnMouseDown += new GpsViewNET.OnMouseDown(map1_OnMouseDown);
map1.OnMouseUp += new GpsViewNET.OnMouseUp(map1_OnMouseUp);
map1.OnDraw += new GpsViewNET.OnDraw(map1_OnMapPaint);
map1.OnMouseMove += new GpsViewNET.OnMouseMove(map1_OnMouseMove);
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem_exit = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem_loadDataSet = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.mapView = new System.Windows.Forms.TabPage();
this.statusBar = new System.Windows.Forms.Label();
this.detailsView = new System.Windows.Forms.TabPage();
this.tabControl1.SuspendLayout();
this.mapView.SuspendLayout();
this.SuspendLayout();
//
// openFileDialog
//
this.openFileDialog.Filter = "Shape files|*.shp|All files|*.*";
//
// mainMenu1
//
this.mainMenu1.MenuItems.Add(this.menuItem1);
this.mainMenu1.MenuItems.Add(this.menuItem2);
this.mainMenu1.MenuItems.Add(this.menuItem3);
//
// menuItem1
//
this.menuItem1.MenuItems.Add(this.menuItem_loadDataSet);
this.menuItem1.MenuItems.Add(this.menuItem6);
this.menuItem1.MenuItems.Add(this.menuItem7);
this.menuItem1.MenuItems.Add(this.menuItem_exit);
this.menuItem1.Text = "File";
//
// menuItem_exit
//
this.menuItem_exit.Text = "Exit";
this.menuItem_exit.Click += new System.EventHandler(this.menuItem_exit_Click);
//
// menuItem7
//
this.menuItem7.Text = "-";
//
// menuItem_loadDataSet
//
this.menuItem_loadDataSet.Text = "Load Data Set";
this.menuItem_loadDataSet.Click += new System.EventHandler(this.menuItem_loadDataSet_Click);
//
// menuItem6
//
this.menuItem6.Text = "Export Notes";
//
// menuItem2
//
this.menuItem2.Text = "Options";
//
// menuItem3
//
this.menuItem3.Text = "New Note";
//
// tabControl1
//
this.tabControl1.Controls.Add(this.mapView);
this.tabControl1.Controls.Add(this.detailsView);
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(240, 268);
this.tabControl1.TabIndex = 0;
//
// mapView
//
this.mapView.Controls.Add(this.statusBar);
this.mapView.Location = new System.Drawing.Point(0, 0);
this.mapView.Name = "mapView";
this.mapView.Size = new System.Drawing.Size(240, 245);
this.mapView.Text = "Map View";
//
// statusBar
//
this.statusBar.ForeColor = System.Drawing.Color.Black;
this.statusBar.Location = new System.Drawing.Point(3, 226);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(234, 20);
this.statusBar.Text = "No data loaded.";
//
// detailsView
//
this.detailsView.Location = new System.Drawing.Point(0, 0);
this.detailsView.Name = "detailsView";
this.detailsView.Size = new System.Drawing.Size(232, 42);
this.detailsView.Text = "Details View";
//
// Form1
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.ClientSize = new System.Drawing.Size(240, 268);
this.Controls.Add(this.tabControl1);
this.KeyPreview = true;
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "MapWorld Mobile";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
this.tabControl1.ResumeLayout(false);
this.mapView.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
Application.Run(new Form1());
}
private void map1_OnMouseMove(MouseButtons Button, short Shift, GpsToolsNET.Position objPosition, GpsViewNET.Point objPoint)
{
if (m_pointFirst != null)
{
m_pointLast = objPoint;
map1.Refresh();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -