?? mainfrm.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using LineViewLib; //(矢量圖控件)
namespace GisCtlDemo
{
/// <summary>
/// Form1 的摘要說明。
/// </summary>
public class MainFrm : System.Windows.Forms.Form
{
#region 自定義變量
/// <summary>
/// 矢量圖控件
/// </summary>
private LineViewCtl m_LineViewer;
/// <summary>
/// 緩存最近一次選中的菜單項
/// </summary>
private MenuItem m_LastCheckedMenuItem=null;
#endregion
#region 窗體設計器變量
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem mnDrawDemo;
private System.Windows.Forms.MenuItem mnOpenPic;
private System.Windows.Forms.MenuItem mnSavePic;
private System.Windows.Forms.MenuItem mnLayerMgr;
private System.Windows.Forms.MenuItem mnNaviDlg;
private System.Windows.Forms.MenuItem mnClosePic;
private System.Windows.Forms.MenuItem mnExit;
private System.Windows.Forms.MenuItem menuItem10;
private System.Windows.Forms.MenuItem mnAbout;
private System.Windows.Forms.ToolBar toolBar1;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.MenuItem mnCurTool;
private System.Windows.Forms.MenuItem mnToolPan;
private System.Windows.Forms.MenuItem mnToolZoomRect;
private System.Windows.Forms.MenuItem mnToolSelObj;
private System.Windows.Forms.MenuItem mnToolSetCenter;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem mnOptionsDlg;
private System.Windows.Forms.ToolBarButton toolBarButton0;
private System.Windows.Forms.ToolBarButton toolBarButton1;
private System.Windows.Forms.ToolBarButton toolBarButton2;
private System.Windows.Forms.ToolBarButton toolBarButton3;
private System.Windows.Forms.ToolBarButton toolBarButton4;
private System.Windows.Forms.MainMenu mainMenu1;
#endregion
public MainFrm()
{
InitializeComponent();
//創建單線圖瀏覽控件!
this.m_LineViewer=new LineViewCtl();
//設置在客戶區位置
this.m_LineViewer.Bounds=new Rectangle(0,0,this.Width,this.Height);
//Init是一個重要的函數,必須創建后調用
this.m_LineViewer.Init();
this.m_LineViewer.Parent=this;
this.m_LineViewer.MapObjectDbClk+=new MapObjectEventHandler(m_LineViewer_MapObjectDbClk);
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows 窗體設計器生成的代碼
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainFrm));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.mnExit = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.mnAbout = new System.Windows.Forms.MenuItem();
this.menuItem10 = new System.Windows.Forms.MenuItem();
this.mnDrawDemo = new System.Windows.Forms.MenuItem();
this.mnOpenPic = new System.Windows.Forms.MenuItem();
this.mnSavePic = new System.Windows.Forms.MenuItem();
this.mnClosePic = new System.Windows.Forms.MenuItem();
this.mnNaviDlg = new System.Windows.Forms.MenuItem();
this.mnLayerMgr = new System.Windows.Forms.MenuItem();
this.mnOptionsDlg = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.mnCurTool = new System.Windows.Forms.MenuItem();
this.mnToolPan = new System.Windows.Forms.MenuItem();
this.mnToolZoomRect = new System.Windows.Forms.MenuItem();
this.mnToolSelObj = new System.Windows.Forms.MenuItem();
this.mnToolSetCenter = new System.Windows.Forms.MenuItem();
this.toolBar1 = new System.Windows.Forms.ToolBar();
this.toolBarButton0 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton3 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton4 = new System.Windows.Forms.ToolBarButton();
this.imageList1 = new System.Windows.Forms.ImageList();
//
// mainMenu1
//
this.mainMenu1.MenuItems.Add(this.menuItem1);
//
// menuItem1
//
this.menuItem1.MenuItems.Add(this.mnExit);
this.menuItem1.MenuItems.Add(this.menuItem3);
this.menuItem1.MenuItems.Add(this.mnAbout);
this.menuItem1.MenuItems.Add(this.menuItem10);
this.menuItem1.MenuItems.Add(this.mnDrawDemo);
this.menuItem1.MenuItems.Add(this.mnOpenPic);
this.menuItem1.MenuItems.Add(this.mnSavePic);
this.menuItem1.MenuItems.Add(this.mnClosePic);
this.menuItem1.MenuItems.Add(this.mnNaviDlg);
this.menuItem1.MenuItems.Add(this.mnLayerMgr);
this.menuItem1.MenuItems.Add(this.mnOptionsDlg);
this.menuItem1.MenuItems.Add(this.menuItem2);
this.menuItem1.MenuItems.Add(this.mnCurTool);
this.menuItem1.Text = "矢量圖控件";
//
// mnExit
//
this.mnExit.Text = "退出程序 exit";
this.mnExit.Click += new System.EventHandler(this.mnExit_Click);
//
// menuItem3
//
this.menuItem3.Text = "-";
//
// mnAbout
//
this.mnAbout.Text = "關于本程序 about";
this.mnAbout.Click += new System.EventHandler(this.mnAbout_Click);
//
// menuItem10
//
this.menuItem10.Text = "-";
//
// mnDrawDemo
//
this.mnDrawDemo.Text = "繪制樣例 demo";
this.mnDrawDemo.Click += new System.EventHandler(this.mnDrawDemo_Click);
//
// mnOpenPic
//
this.mnOpenPic.Text = "打開圖形 open";
this.mnOpenPic.Click += new System.EventHandler(this.mnOpenPic_Click);
//
// mnSavePic
//
this.mnSavePic.Text = "保存圖形 save";
this.mnSavePic.Click += new System.EventHandler(this.mnSavePic_Click);
//
// mnClosePic
//
this.mnClosePic.Text = "關閉圖形 close";
this.mnClosePic.Click += new System.EventHandler(this.mnClosePic_Click);
//
// mnNaviDlg
//
this.mnNaviDlg.Text = "導航器 navi";
this.mnNaviDlg.Click += new System.EventHandler(this.mnNaviDlg_Click);
//
// mnLayerMgr
//
this.mnLayerMgr.Text = "圖層管理 layer";
this.mnLayerMgr.Click += new System.EventHandler(this.mnLayerMgr_Click);
//
// mnOptionsDlg
//
this.mnOptionsDlg.Text = "選項設置 option";
this.mnOptionsDlg.Click += new System.EventHandler(this.mnOptionsDlg_Click);
//
// menuItem2
//
this.menuItem2.Text = "-";
//
// mnCurTool
//
this.mnCurTool.MenuItems.Add(this.mnToolPan);
this.mnCurTool.MenuItems.Add(this.mnToolZoomRect);
this.mnCurTool.MenuItems.Add(this.mnToolSelObj);
this.mnCurTool.MenuItems.Add(this.mnToolSetCenter);
this.mnCurTool.Text = "當前工具 tool";
//
// mnToolPan
//
this.mnToolPan.Text = "平移 pan";
this.mnToolPan.Click += new System.EventHandler(this.mnToolPan_Click);
//
// mnToolZoomRect
//
this.mnToolZoomRect.Text = "矩形縮放 rect";
this.mnToolZoomRect.Click += new System.EventHandler(this.mnToolZoomRect_Click);
//
// mnToolSelObj
//
this.mnToolSelObj.Text = "選取對象 capture";
this.mnToolSelObj.Click += new System.EventHandler(this.mnToolSelObj_Click);
//
// mnToolSetCenter
//
this.mnToolSetCenter.Text = "設置中心點 center";
this.mnToolSetCenter.Click += new System.EventHandler(this.mnToolSetCenter_Click);
//
// toolBar1
//
this.toolBar1.Buttons.Add(this.toolBarButton0);
this.toolBar1.Buttons.Add(this.toolBarButton1);
this.toolBar1.Buttons.Add(this.toolBarButton2);
this.toolBar1.Buttons.Add(this.toolBarButton3);
this.toolBar1.Buttons.Add(this.toolBarButton4);
this.toolBar1.ImageList = this.imageList1;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// toolBarButton0
//
this.toolBarButton0.ImageIndex = 0;
//
// toolBarButton1
//
this.toolBarButton1.ImageIndex = 1;
//
// toolBarButton2
//
this.toolBarButton2.ImageIndex = 8;
//
// toolBarButton3
//
this.toolBarButton3.ImageIndex = 3;
//
// toolBarButton4
//
this.toolBarButton4.ImageIndex = 4;
//
// imageList1
//
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource"))));
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource1"))));
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource2"))));
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource3"))));
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource4"))));
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource5"))));
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource6"))));
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource7"))));
this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource8"))));
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
//
// MainFrm
//
this.ClientSize = new System.Drawing.Size(240, 258);
this.Controls.Add(this.toolBar1);
this.Menu = this.mainMenu1;
this.Text = "矢量圖控件DEMO";
}
#endregion
/// <summary>
/// 應用程序的主入口點。
/// </summary>
static void Main()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -