Form1.cs
上传用户:zhkydz
上传日期:2018-03-23
资源大小:88k
文件大小:24k
源码类别:

其他行业

开发平台:

C#

  1. using System;
  2. using System.IO;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. ////    ESRI
  10. using ESRI.ArcGIS.Carto;
  11. using ESRI.ArcGIS.Geometry;
  12. using ESRI.ArcGIS.Display;
  13. using ESRI.ArcGIS.Controls;
  14. using ESRI.ArcGIS.DataSourcesFile;
  15. using ESRI.ArcGIS.Geodatabase;
  16. using ESRI.ArcGIS.SystemUI;
  17. using ESRI.ArcGIS.Framework;
  18. using ESRI.ArcGIS.DisplayUI;
  19. using ESRI.ArcGIS.Utility.BaseClasses;
  20. using ESRI.ArcGIS.CartoUI;
  21. using ESRI.ArcGIS.esriSystem;
  22. namespace ArcGisEngineNewProject
  23. {
  24.     public partial class Form1 : Form
  25.     {
  26.         private int x=0, y=0;
  27.         private IToolbarMenu mapMenu = null;
  28.         private ITOCControl mTOCControl;
  29.         private ILayer pMoveLayer;
  30.         private int Toindex;
  31.         //声明变量moveLayer,用于判断移动图层操作的顺序,0为不可移动,-4选择移动图层,4为选择移动位置
  32.         private static int moveLayer = 0;
  33.         //更改图层的图例样式,changeLegend为4时更改,为0时不能
  34.         private static int changeLegend = 0;
  35.         //删除选中图层,deleteLayer为4时可删除图层,为0时不能
  36.         private static int deleteLayer = 0;
  37.         //点击地图要素,显示相关属性,viewFeature为4时可以查看要素属性,为0时不能
  38.         private static int viewFeature = 0;
  39.         //======================================================
  40.         public Form1()
  41.         {
  42.             InitializeComponent();
  43.             this.mapMenu = new ToolbarMenu();
  44.             this.mapMenu.SetHook(this.myMapControl1);
  45.         }
  46.         //鹰眼功能中当地图恢复时刷新控件
  47.         private void myMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
  48.         {
  49.             //当主地图窗口更新后,更新鹰眼控件地图
  50.             IMap pMap;
  51.             pMap = myMapControl1.Map;
  52.             int i;
  53.             for (i = 0; i <= pMap.LayerCount - 1; i++)
  54.             {
  55.                 myMapControl2.Map.AddLayer(pMap.get_Layer(i));
  56.             }
  57.             //得到新范围
  58.             IEnvelope pEnv;
  59.             pEnv = e.newEnvelope as IEnvelope;
  60.             IGraphicsContainer pGraphicsContainer;
  61.             IActiveView pActiveView;
  62.             pGraphicsContainer = myMapControl2.Map as IGraphicsContainer;
  63.             pActiveView = pGraphicsContainer as IActiveView;
  64.             //在绘制新的矩形框前,清除Map对象中的任何图形元素
  65.             pGraphicsContainer.DeleteAllElements();
  66.             IRectangleElement pRectangleEle;
  67.             pRectangleEle = new RectangleElementClass();
  68.             IElement pEle;
  69.             pEle = pRectangleEle as IElement;
  70.             pEle.Geometry = pEnv;
  71.             IRgbColor pColor;
  72.             pColor = new RgbColorClass();
  73.             pColor.RGB = 255;
  74.             pColor.Transparency = 255;
  75.             //产生一个线符号对象
  76.             ILineSymbol pOutline;
  77.             pOutline = new SimpleLineSymbolClass();
  78.             //设置线符号的属性
  79.             pOutline.Width = 1;
  80.             pOutline.Color = pColor;
  81.             //设置颜色属性
  82.             pColor = new RgbColorClass();
  83.             pColor.RGB = 255;
  84.             pColor.Transparency = 0;
  85.             //设置填充符号的属性
  86.             IFillSymbol pFillSymbol;
  87.             pFillSymbol = new SimpleFillSymbolClass();
  88.             pFillSymbol.Color = pColor;
  89.             pFillSymbol.Outline = pOutline;
  90.             IFillShapeElement pFillshapeEle;
  91.             pFillshapeEle = pEle as IFillShapeElement;
  92.             pFillshapeEle.Symbol = pFillSymbol;
  93.             pEle = pFillshapeEle as IElement;
  94.             pGraphicsContainer.AddElement(pEle, 0);
  95.             pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
  96.             //drowlittleViewMap(e.newEnvelope as IEnvelope);
  97.         }
  98.         //若图层名称为空,则更名失败
  99.         private void axTOCControl1_OnEndLabelEdit(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnEndLabelEditEvent e)
  100.         {
  101.             string newLabel = e.newLabel;
  102.             if (newLabel.Trim() == "")
  103.             {
  104.                 e.canEdit = false;
  105.             }
  106.         }
  107.         //右键添加shp图层
  108.         private void addToolStripMenuItem_Click(object sender, EventArgs e)
  109.         {
  110.             IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
  111.             openFileDialog1.Filter = "(*.shp)|*.shp";
  112.             openFileDialog1.InitialDirectory = @"D:";
  113.             openFileDialog1.Multiselect = false ;
  114.             DialogResult pDialogResult = openFileDialog1.ShowDialog();
  115.             if (pDialogResult != DialogResult.OK)
  116.                 return;
  117.             string pPath = openFileDialog1.FileName;
  118.             string pFilePath = System.IO.Path.GetDirectoryName(pPath);
  119.             string pFileName = System.IO.Path.GetFileName(pPath);
  120.             IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile(pFilePath , 0);
  121.             IFeatureWorkspace pFeatureWorkspace = pWorkspace as IFeatureWorkspace;
  122.             IFeatureClass pFC = pFeatureWorkspace.OpenFeatureClass(pFileName);
  123.             IFeatureLayer pFlayer = new FeatureLayerClass();
  124.             pFlayer.FeatureClass = pFC;
  125.             pFlayer.Name = pFC.AliasName;
  126.             ILayer pLayer = pFlayer as ILayer;
  127.             IMap pMap = myMapControl1.Map;
  128.             pMap.AddLayer(pLayer);
  129.             myMapControl1.ActiveView.Refresh();
  130.             myMapControl2.ActiveView.Refresh();
  131.         }
  132.         //添加lyr图层文件
  133.         private void 添加lyr图层ToolStripMenuItem_Click(object sender, EventArgs e)
  134.         {
  135.             IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
  136.             openFileDialog1.Filter = "(*.lyr)|*.lyr";
  137.             openFileDialog1.InitialDirectory = @"D:";
  138.             openFileDialog1.Multiselect = false;
  139.             DialogResult pDialogResult = openFileDialog1.ShowDialog();
  140.             if (pDialogResult != DialogResult.OK)
  141.                 return;
  142.             string pFileName = openFileDialog1.FileName;
  143.             myMapControl1.AddLayerFromFile(pFileName);
  144.             myMapControl1.ActiveView.Refresh();
  145.             myMapControl2.ActiveView.Refresh();
  146.         }
  147.         //右键删除图层
  148.         private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
  149.         {
  150.             deleteLayer = 4;
  151.             MessageBox.Show("请选择要删除的图层!", "删除图层");
  152.         }
  153.         //改变图层样式
  154.         private void changestyleToolStripMenuItem_Click(object sender, EventArgs e)
  155.         {
  156.             changeLegend = 4;
  157.             MessageBox.Show ("请选择要更改样式的图层!", "样式更改");
  158.             
  159.         }
  160.         //全部删除图层
  161.         private void removeToolStripMenuItem_Click(object sender, EventArgs e)
  162.         {
  163.             IMap myMap = myMapControl1.Map;
  164.             myMap.ClearLayers();
  165.             axTOCControl1.Update();
  166.             myMapControl1.ActiveView.Refresh();
  167.         }
  168.         //TOCControl单击事件:出现快捷菜单,更改图例样式,删除图层
  169.         private void axTOCControl1_OnMouseDown(object sender, ITOCControlEvents_OnMouseDownEvent e)
  170.         {
  171.             x = e.x;
  172.             y = e.y;
  173.             //单击鼠标左键
  174.             if (e.button == 1)
  175.             {
  176.                 esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
  177.                 IBasicMap map = null;
  178.                 ILayer layer = null;
  179.                 object other = null;
  180.                 object index = null;
  181.                 int pLayerIndex = 0;
  182.                 //返回单击在TOCControl中位置
  183.                 axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);
  184.                 IMap pMap = axTOCControl1.ActiveView.FocusMap;
  185.                 //更改图层图例
  186.                 if(changeLegend ==4)
  187.                 {
  188.                     //判断是否单击图层或图例
  189.                     if (item == esriTOCControlItem.esriTOCControlItemLegendClass || item ==esriTOCControlItem .esriTOCControlItemLayer )
  190.                     {
  191.                         ILayer pTempLayer;
  192.                         for (int i = 0; i < pMap.LayerCount; i++)
  193.                         {
  194.                             pTempLayer = pMap.get_Layer(i);
  195.                             if (pTempLayer == layer)
  196.                             {
  197.                                 pLayerIndex = i;
  198.                                 break;
  199.                             }
  200.                         }
  201.                         //声明要更改图例的图层位置
  202.                         ISymbolSelector pSymbolSelector;
  203.                         pSymbolSelector = new SymbolSelectorClass();
  204.                         IGeoFeatureLayer pGeoFeatureLayer;
  205.                         pGeoFeatureLayer = this.myMapControl1.get_Layer(pLayerIndex) as IGeoFeatureLayer;
  206.                         //要更改图层图例的图例类型的类的定义
  207.                         IFeatureLayer pFeatureLayer;
  208.                         pFeatureLayer = this.myMapControl1.get_Layer(pLayerIndex) as IFeatureLayer;
  209.                         esriGeometryType pType;
  210.                         IFeatureClass pFeatureClass;
  211.                         pFeatureClass = pFeatureLayer.FeatureClass;
  212.                         pType = pFeatureClass.ShapeType;
  213.                         //判断图例的类型:点,线,面
  214.                         switch (pType)
  215.                         {
  216.                             //定义点的简单符号样式对话框
  217.                             case esriGeometryType.esriGeometryPoint:
  218.                                 //MessageBox.Show("point");
  219.                                 ISimpleMarkerSymbol pSimpleMarkerSymbol;
  220.                                 pSimpleMarkerSymbol = new SimpleMarkerSymbolClass();
  221.                                 pSymbolSelector.AddSymbol(pSimpleMarkerSymbol as ISymbol);
  222.                                 break;
  223.                             //定义线的简单符号样式对话框
  224.                             case esriGeometryType.esriGeometryPolyline:
  225.                                 //MessageBox.Show("line");
  226.                                 ISimpleLineSymbol pSimpleLineSymbol;
  227.                                 pSimpleLineSymbol = new SimpleLineSymbolClass();
  228.                                 pSymbolSelector.AddSymbol(pSimpleLineSymbol as ISymbol);
  229.                                 break;
  230.                             //定义面得简单符号样式对话框
  231.                             case esriGeometryType.esriGeometryPolygon:
  232.                                 //MessageBox.Show("polygon");
  233.                                 ISimpleFillSymbol pSimpleFillSymbol;
  234.                                 pSimpleFillSymbol = new SimpleFillSymbolClass();
  235.                                 pSymbolSelector.AddSymbol(pSimpleFillSymbol as ISymbol);
  236.                                 break;
  237.                             default:
  238.                                 MessageBox.Show("未知的图例类型!", "错误");
  239.                                 return;
  240.                         }
  241.                         //当选择对话框的图例对象时进入,再更改所在图例样式
  242.                         if (pSymbolSelector.SelectSymbol(0))
  243.                         {
  244.                             ISymbol pSymbol;
  245.                             ISimpleRenderer pRenderer;
  246.                             pSymbol = pSymbolSelector.GetSymbolAt(0);
  247.                             pRenderer = new SimpleRendererClass();
  248.                             pRenderer.Symbol = pSymbol;
  249.                             pGeoFeatureLayer.Renderer = pRenderer as IFeatureRenderer;
  250.                             this.myMapControl1.Refresh();
  251.                             this.axTOCControl1.Update();
  252.                             pGeoFeatureLayer.GetType();
  253.                         }
  254.                         changeLegend = 0;
  255.                     }
  256.                     }
  257.                     //删除单个图层
  258.                     else if(deleteLayer ==4)
  259.                     {
  260.                         //确保有项目被选择
  261.                         if (item == esriTOCControlItem.esriTOCControlItemMap)
  262.                         {
  263.                             //ILayer l = null;
  264.                             if (MessageBox.Show("确实要删除地图 " + map.Name+" 吗?", "删除地图", MessageBoxButtons.YesNo) == DialogResult.Yes) 
  265.                             {
  266.                                 pMap.ClearLayers();
  267.                                 myMapControl1.ActiveView.Refresh();
  268.                                 mTOCControl.Update();
  269.                             }
  270.                         }
  271.                         else if (item == esriTOCControlItem.esriTOCControlItemLayer)
  272.                         {
  273.                             if (MessageBox.Show("确实要删除图层 " + layer.Name+" 吗?", "删除图层", MessageBoxButtons.YesNo) == DialogResult.Yes)
  274.                             {
  275.                                 pMap.DeleteLayer(layer);
  276.                                 myMapControl1.ActiveView.Refresh();
  277.                                 mTOCControl.Update();
  278.                             }
  279.                         }
  280.                         else
  281.                             MessageBox.Show("未选择任何内容!","错误");
  282.                         deleteLayer = 0;
  283.                     }
  284.                 }
  285.                 else if (e.button == 2)//右键弹出菜单
  286.                 {
  287.                     this.mapMenu.PopupMenu(e.x, e.y, this.axTOCControl1.hWnd);
  288.                 }
  289.             }
  290.         //载入窗体,向ToolbarControl加载按钮,设置ToolbarControl和TOCControl与MapControl的关联
  291.         private void Form1_Load(object sender, EventArgs e)
  292.         {
  293.             //关联控件
  294.             axTOCControl1.SetBuddyControl(myMapControl1);
  295.             myToolbarControl.SetBuddyControl(myMapControl1);
  296.             //添加toolbar控件按钮
  297.             string uID = null;
  298.             uID = "esriControlTools.ControlsOpenDocCommand";
  299.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  300.             uID = "esriControlTools.ControlsAddDataCommand";
  301.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  302.   
  303.             uID = "esriControlTools.ControlsMapZoomInTool";
  304.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  305.             uID = "esriControlTools.ControlsMapZoomOutTool";
  306.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  307.             uID = "esriControlTools.ControlsMapZoomInFixedCommand";
  308.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  309.             uID = "esriControlTools.ControlsMapZoomOutFixedCommand";
  310.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  311.             uID = "esriControlTools.ControlsMapPanTool";
  312.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  313.             uID = "esriControlTools.ControlsMapFullExtentCommand";
  314.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  315.             uID = "esriControlTools.ControlsMapZoomToLastExtentBackCommand";
  316.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  317.             uID = "esriControlTools.ControlsMapZoomToLastExtentForwardCommand";
  318.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  319.             uID = "esriControlTools.ControlsMapIdentifyTool";
  320.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  321.             uID = "esriControlTools.ControlsSelectFeaturesTool";
  322.             myToolbarControl.AddItem(uID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
  323.         }
  324.         //窗体卸载时调用Engine关闭函数(卸载内存中内容,以免内存出错,但不知为什么必须得调用)
  325.         private void Form1_FormClosed(object sender, FormClosedEventArgs e)
  326.         {
  327.             ESRI.ArcGIS.ADF.COMSupport.AOUninitialize.Shutdown();
  328.         }
  329.         //快捷菜单右键移动图层
  330.         private void movelayerToolStripMenuItem_Click(object sender, EventArgs e)
  331.         {
  332.             moveLayer  = -4;
  333.             MessageBox.Show("请选择要移动的图层!", "调整图层顺序");
  334.            
  335.         }
  336.         //鼠标弹起事件
  337.         private void axTOCControl1_OnMouseUp(object sender, ITOCControlEvents_OnMouseUpEvent e)
  338.         {
  339.             if (e.button == 1)//单击鼠标左键
  340.             {
  341.                     if (moveLayer  == -4)//调整图层顺序
  342.                     {
  343.                         mTOCControl = axTOCControl1.Object as ITOCControl;
  344.                         esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
  345.                         IBasicMap map = null;
  346.                         ILayer layer = null;
  347.                         object other = null;
  348.                         object index = null;
  349.                         mTOCControl.HitTest(x, y, ref item, ref map, ref layer, ref other, ref index);
  350.                         if (item == esriTOCControlItem.esriTOCControlItemLayer)
  351.                         {
  352.                             if (layer is IAnnotationSublayer)
  353.                             {
  354.                                 return;
  355.                             }
  356.                             else
  357.                             {
  358.                                 pMoveLayer = layer;
  359.                                 MessageBox.Show("图层:" + layer.Name + " 被选中nn请单击图层目的位置!", "调整图层顺序");
  360.                             }
  361.                         }
  362.                         moveLayer  = 4;//将图层调整进行到第2步,选择移动到得目的位置
  363.                     }
  364.                     else if (moveLayer == 4)//调整图层顺序
  365.                     {
  366.                         esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
  367.                         IBasicMap map = null;
  368.                         ILayer layer = null;
  369.                         object other = null;
  370.                         object index = null;
  371.                         mTOCControl.HitTest(x, y, ref item, ref map, ref layer, ref other, ref index);
  372.                         IMap pMap = axTOCControl1.ActiveView.FocusMap;
  373.                         if (item == esriTOCControlItem.esriTOCControlItemLayer || layer != null)
  374.                         {
  375.                             if (pMoveLayer != layer)
  376.                             {
  377.                                 ILayer pTempLayer;
  378.                                 for (int i = 0; i < pMap.LayerCount; i++)
  379.                                 {
  380.                                     pTempLayer = pMap.get_Layer(i);
  381.                                     if (pTempLayer == layer)
  382.                                     {
  383.                                         Toindex = i;
  384.                                     }
  385.                                 }
  386.                                 pMap.MoveLayer(pMoveLayer, Toindex);
  387.                                 myMapControl1.ActiveView.Refresh();
  388.                                 mTOCControl.Update();
  389.                                
  390.                                 MessageBox.Show("图层顺序调整成功!","调整图层顺序");
  391.                             }
  392.                         }
  393.                         moveLayer = 0;//图层调整完后,将图层调整事件重新关闭
  394.                     }
  395.             }
  396.         }
  397.         //编辑图层名称
  398.         private void axTOCControl1_OnBeginLabelEdit(object sender, ITOCControlEvents_OnBeginLabelEditEvent e)
  399.         {
  400.             IBasicMap map = null;
  401.             ILayer layer = null;
  402.             object other = null;
  403.             object index = null;
  404.             esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
  405.             //Determine what kind of item has been clicked on
  406.             axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);
  407.             //Only layer items can have their labels edited
  408.             if (item != esriTOCControlItem.esriTOCControlItemLayer)
  409.             {
  410.                 e.canEdit = false;
  411.             }
  412.         }
  413.         //查看要素属性信息
  414.         private void viewInfToolStripMenuItem_Click(object sender, EventArgs e)
  415.         {
  416.             if (viewFeature == 0)
  417.             {
  418.                 viewFeature = 4;
  419.                 myToolbarControl.CurrentTool = null;
  420.                 myToolbarControl.Enabled = false;  
  421.                 viewInfToolStripMenuItem.Text = "停止查看属性";
  422.                 myMapControl1.MousePointer = esriControlsMousePointer.esriPointerCustom;
  423.                 MessageBox.Show("看完后,记得右键‘停止查看属性’哦!", "提示");
  424.             }
  425.             else
  426.             {
  427.                 viewFeature = 0;
  428.                 myToolbarControl.Enabled = true;
  429.                 viewInfToolStripMenuItem.Text = "查看属性信息";
  430.             }
  431.         }
  432.         //控件随着窗体的大小更改而改变
  433.         private void Form1_Resize(object sender, EventArgs e)
  434.         {
  435.             //随着主窗体大小的改变,其中的控件大小也随着改变
  436.             this.myMapControl1.Width = this .Width- this.myMapControl1 .Left-10 ;
  437.             this.myMapControl1.Height =this.Height - this.myToolbarControl.Height ;
  438.             this.axTOCControl1.Height = this.Height - this.myMapControl2.Height-this.myToolbarControl .Height-5 ;
  439.             this.myMapControl2.Top = this.myMapControl1.Top + this.myMapControl1.Height - this.myMapControl2.Height;
  440.             this.myMapControl2.Width = this.axTOCControl1.Width;
  441.         }
  442.         //myMapControl1中点击要素,则显示要素属性
  443.         private void myMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
  444.         {
  445.             if (e.button == 1)
  446.             {
  447.                 if (viewFeature == 4)
  448.                 {
  449.                     //myMapControl1.MousePointer = esriControlsMousePointer.esriPointerArrow;
  450.                     IActiveView activeview = myMapControl1.ActiveView;
  451.                     IEnumLayer pEnumLayer;
  452.                     IIdentifyDialogProps pIdentifyDialogProps;
  453.                     IIdentifyDialog pIdentifyDialog = new IdentifyDialogClass();
  454.                     pIdentifyDialog.Map = myMapControl1.Map;
  455.                     pIdentifyDialog.Display = activeview.ScreenDisplay;
  456.                     pIdentifyDialog.ClearLayers();
  457.                     pIdentifyDialogProps = pIdentifyDialog as IIdentifyDialogProps;
  458.                     pEnumLayer = pIdentifyDialogProps.Layers;
  459.                     pEnumLayer.Reset();
  460.                     ILayer pLayer = pEnumLayer.Next();
  461.                     while (pLayer != null)
  462.                     {
  463.                         pIdentifyDialog.AddLayerIdentifyPoint(pLayer, e.x, e.y);
  464.                         pLayer = pEnumLayer.Next();
  465.                     }
  466.                     pIdentifyDialog.Show();
  467.                 }
  468.             }
  469.             else if (e.button == 2)
  470.             {
  471.             }
  472.         }
  473.         //退出程序
  474.         private void exitToolStripMenuItem_Click(object sender, EventArgs e)
  475.         {
  476.             this.Close();
  477.         }
  478.     }  
  479. }