📄 form_main.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
// ESRI Assemblies
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.DataSourcesGDB;
namespace Cstest1
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form_Main : System.Windows.Forms.Form
{
public ESRI.ArcGIS.MapControl.AxMapControl MainMap; //声明为公有对象
private System.Windows.Forms.ToolBar toolBar_Standard;
private System.Windows.Forms.ImageList imageList_Standard;
private System.Windows.Forms.ToolBarButton toolBarButton_AddData;
private System.Windows.Forms.ToolBarButton toolBarButton_ZoomIn;
private System.Windows.Forms.ToolBarButton toolBarButton_ZoomOut;
private System.Windows.Forms.ToolBarButton toolBarButton_Pan;
private System.Windows.Forms.ToolBarButton toolBarButton_Gobal;
private System.Windows.Forms.ToolBarButton toolBarButton_Select;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.ToolBarButton toolBarButton_Identify;
private System.Windows.Forms.ToolBarButton toolBarButton_Find;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.StatusBarPanel statusBarPanel_Tip;
private System.Windows.Forms.StatusBarPanel statusBarPanel_MousePoint;
private System.Windows.Forms.MenuItem menuItem_ClearLayers;
private System.Windows.Forms.MenuItem menuItem_AddData;
private System.Windows.Forms.MenuItem menuItem_SDEConect;
private System.Windows.Forms.MenuItem menuItem_Export;
private System.Windows.Forms.MenuItem menuItem1_Atrribute;
private System.Windows.Forms.MenuItem menuItem_SaveEdit;
private System.Windows.Forms.ComboBox comboBox_MapScale;
private System.Windows.Forms.MenuItem menuItem_Quit;
private System.Windows.Forms.StatusBar statusBar_Info;
private System.Windows.Forms.MenuItem menuItem_Data;
private System.Windows.Forms.MenuItem menuItem_Query;
private System.Windows.Forms.MenuItem menuItem_Editor;
private System.Windows.Forms.ToolBarButton toolBarButton_StartEdit;
private System.Windows.Forms.ToolBarButton toolBarButton_Separator1;
private System.Windows.Forms.ToolBarButton toolBarButton_Separator2;
private System.Windows.Forms.ToolBarButton toolBarButton_SaveEdit;
private System.Windows.Forms.ToolBarButton toolBarButton_StopEdit;
private System.Windows.Forms.ToolBarButton toolBarButton_Sketch;
private System.Windows.Forms.ToolBarButton toolBarButton_Copy;
private System.Windows.Forms.ToolBarButton toolBarButton_Paste;
private System.Windows.Forms.ToolBarButton toolBarButton_Delete;
private System.Windows.Forms.ComboBox comboBox_Target;
private System.Windows.Forms.ComboBox comboBox_EditTask;
private System.Windows.Forms.MenuItem menuItem_ExportSelectionSet;
private System.Windows.Forms.MenuItem menuItem_ExportView;
private System.Windows.Forms.MenuItem menuItem_StartEdit;
private System.Windows.Forms.MenuItem menuItem_StopEdit;
//变量声明
private IMap m_Map; //地图编辑
private ILayer m_CurrentLayer; //当前编辑图层
private IGeometryCollection m_GeoCollecton; //地图中的选中要素(将被复制)
private bool m_bModify; //判断是否在编辑修改要素
private bool m_bSketch; //判断是否在新建要素
private bool m_bCopy; //判断是否复制了要素
public Form_Main()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form_Main));
this.MainMap = new ESRI.ArcGIS.MapControl.AxMapControl();
this.imageList_Standard = new System.Windows.Forms.ImageList(this.components);
this.toolBar_Standard = new System.Windows.Forms.ToolBar();
this.toolBarButton_AddData = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_ZoomIn = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_ZoomOut = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Pan = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Gobal = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Select = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Separator1 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Identify = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Find = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Separator2 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_StartEdit = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_SaveEdit = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_StopEdit = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Sketch = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Copy = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Paste = new System.Windows.Forms.ToolBarButton();
this.toolBarButton_Delete = new System.Windows.Forms.ToolBarButton();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem_Data = new System.Windows.Forms.MenuItem();
this.menuItem_AddData = new System.Windows.Forms.MenuItem();
this.menuItem_SDEConect = new System.Windows.Forms.MenuItem();
this.menuItem_Export = new System.Windows.Forms.MenuItem();
this.menuItem_ExportSelectionSet = new System.Windows.Forms.MenuItem();
this.menuItem_ExportView = new System.Windows.Forms.MenuItem();
this.menuItem_ClearLayers = new System.Windows.Forms.MenuItem();
this.menuItem_Quit = new System.Windows.Forms.MenuItem();
this.menuItem_Query = new System.Windows.Forms.MenuItem();
this.menuItem1_Atrribute = new System.Windows.Forms.MenuItem();
this.menuItem_Editor = new System.Windows.Forms.MenuItem();
this.menuItem_StartEdit = new System.Windows.Forms.MenuItem();
this.menuItem_SaveEdit = new System.Windows.Forms.MenuItem();
this.menuItem_StopEdit = new System.Windows.Forms.MenuItem();
this.comboBox_MapScale = new System.Windows.Forms.ComboBox();
this.statusBar_Info = new System.Windows.Forms.StatusBar();
this.statusBarPanel_Tip = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel_MousePoint = new System.Windows.Forms.StatusBarPanel();
this.comboBox_Target = new System.Windows.Forms.ComboBox();
this.comboBox_EditTask = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.MainMap)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel_Tip)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel_MousePoint)).BeginInit();
this.SuspendLayout();
//
// MainMap
//
this.MainMap.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.MainMap.Location = new System.Drawing.Point(8, 32);
this.MainMap.Name = "MainMap";
this.MainMap.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("MainMap.OcxState")));
this.MainMap.Size = new System.Drawing.Size(712, 432);
this.MainMap.TabIndex = 6;
this.MainMap.OnMouseMove += new ESRI.ArcGIS.MapControl.IMapControlEvents2_OnMouseMoveEventHandler(this.MainMap_OnMouseMove);
this.MainMap.OnViewRefreshed += new ESRI.ArcGIS.MapControl.IMapControlEvents2_OnViewRefreshedEventHandler(this.MainMap_OnViewRefreshed);
//
// imageList_Standard
//
this.imageList_Standard.ImageSize = new System.Drawing.Size(18, 18);
this.imageList_Standard.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList_Standard.ImageStream")));
this.imageList_Standard.TransparentColor = System.Drawing.Color.Transparent;
//
// toolBar_Standard
//
this.toolBar_Standard.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.toolBarButton_AddData,
this.toolBarButton_ZoomIn,
this.toolBarButton_ZoomOut,
this.toolBarButton_Pan,
this.toolBarButton_Gobal,
this.toolBarButton_Select,
this.toolBarButton_Separator1,
this.toolBarButton_Identify,
this.toolBarButton_Find,
this.toolBarButton_Separator2,
this.toolBarButton_StartEdit,
this.toolBarButton_SaveEdit,
this.toolBarButton_StopEdit,
this.toolBarButton_Sketch,
this.toolBarButton_Copy,
this.toolBarButton_Paste,
this.toolBarButton_Delete});
this.toolBar_Standard.ButtonSize = new System.Drawing.Size(20, 20);
this.toolBar_Standard.Cursor = System.Windows.Forms.Cursors.Default;
this.toolBar_Standard.DropDownArrows = true;
this.toolBar_Standard.ImageList = this.imageList_Standard;
this.toolBar_Standard.Location = new System.Drawing.Point(0, 0);
this.toolBar_Standard.Name = "toolBar_Standard";
this.toolBar_Standard.ShowToolTips = true;
this.toolBar_Standard.Size = new System.Drawing.Size(728, 30);
this.toolBar_Standard.TabIndex = 8;
this.toolBar_Standard.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_Standard_ButtonClick);
//
// toolBarButton_AddData
//
this.toolBarButton_AddData.ImageIndex = 0;
this.toolBarButton_AddData.ToolTipText = "加载";
//
// toolBarButton_ZoomIn
//
this.toolBarButton_ZoomIn.ImageIndex = 1;
this.toolBarButton_ZoomIn.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
this.toolBarButton_ZoomIn.ToolTipText = "放大";
//
// toolBarButton_ZoomOut
//
this.toolBarButton_ZoomOut.ImageIndex = 2;
this.toolBarButton_ZoomOut.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
this.toolBarButton_ZoomOut.ToolTipText = "缩小";
//
// toolBarButton_Pan
//
this.toolBarButton_Pan.ImageIndex = 3;
this.toolBarButton_Pan.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
this.toolBarButton_Pan.ToolTipText = "平移";
//
// toolBarButton_Gobal
//
this.toolBarButton_Gobal.ImageIndex = 4;
//
// toolBarButton_Select
//
this.toolBarButton_Select.ImageIndex = 5;
this.toolBarButton_Select.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
this.toolBarButton_Select.ToolTipText = "选择";
//
// toolBarButton_Separator1
//
this.toolBarButton_Separator1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton_Identify
//
this.toolBarButton_Identify.ImageIndex = 6;
this.toolBarButton_Identify.ToolTipText = "信息查询";
//
// toolBarButton_Find
//
this.toolBarButton_Find.ImageIndex = 7;
this.toolBarButton_Find.ToolTipText = "定位查找";
//
// toolBarButton_Separator2
//
this.toolBarButton_Separator2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton_StartEdit
//
this.toolBarButton_StartEdit.ImageIndex = 8;
this.toolBarButton_StartEdit.ToolTipText = "开始编辑";
//
// toolBarButton_SaveEdit
//
this.toolBarButton_SaveEdit.ImageIndex = 9;
this.toolBarButton_SaveEdit.ToolTipText = "保存编辑";
//
// toolBarButton_StopEdit
//
this.toolBarButton_StopEdit.ImageIndex = 10;
this.toolBarButton_StopEdit.ToolTipText = "停止编辑";
//
// toolBarButton_Sketch
//
this.toolBarButton_Sketch.ImageIndex = 11;
this.toolBarButton_Sketch.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
this.toolBarButton_Sketch.ToolTipText = "草图";
//
// toolBarButton_Copy
//
this.toolBarButton_Copy.ImageIndex = 12;
this.toolBarButton_Copy.ToolTipText = "复制";
//
// toolBarButton_Paste
//
this.toolBarButton_Paste.ImageIndex = 13;
this.toolBarButton_Paste.ToolTipText = "粘贴";
//
// toolBarButton_Delete
//
this.toolBarButton_Delete.ImageIndex = 14;
this.toolBarButton_Delete.ToolTipText = "删除";
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem_Data,
this.menuItem_Query,
this.menuItem_Editor});
//
// menuItem_Data
//
this.menuItem_Data.Index = 0;
this.menuItem_Data.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem_AddData,
this.menuItem_SDEConect,
this.menuItem_Export,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -