private void btOK_Click(object sender, EventArgs e)
        {
            if (cboBoxPointLayer.SelectedItem == null)
            {
                MessageBox.Show("请加载点图层!");
                return;
            }
            if (txtLineFilePath.Text == "")
            {
                MessageBox.Show("请输入要输出线图层的路径及名称!");
                return;
            }
            try
            {
                //从点图层中读取所有点
                string pPointFileName = cboBoxPointLayer.SelectedItem.ToString();
                ILayer pLayer         = null;
                for (int i = 0; i < pMapcontrol.LayerCount; i++)
                {
                    if (pPointFileName == pMapcontrol.get_Layer(i).Name)
                    {
                        pLayer = pMapcontrol.get_Layer(i);
                    }
                }
                psf = ((IGeoDataset)pLayer).SpatialReference;
                IFeatureLayer    pFeatureLayerPoint = pLayer as IFeatureLayer;
                IPointCollection PointCollection    = ReadPoint(pFeatureLayerPoint);

                //判断需要生成的线文件是否存在,若不存在则创建文件,若存在则将新添加的线写入文件
                if (File.Exists(txtLineFilePath.Text))
                {
                    //若已经存在则读取结尾点并加入到PointCollection
                    string pLineFile = txtLineFilePath.Text;
                    string pFilePath = System.IO.Path.GetDirectoryName(pLineFile);
                    string pFileName = System.IO.Path.GetFileName(pLineFile);

                    //打开工作空间
                    IWorkspaceFactory pWSF = new ShapefileWorkspaceFactoryClass();
                    IFeatureWorkspace pWS  = (IFeatureWorkspace)pWSF.OpenFromFile(pFilePath, 0);

                    IFeatureLayer pFeatureLayer = new FeatureLayerClass();
                    pFeatureLayer.FeatureClass = pWS.OpenFeatureClass(pFileName);

                    IField pField = null;
                    if (pFeatureLayer.FeatureClass.Fields.FindField("FID") != -1)
                    {
                        pField = pFeatureLayer.FeatureClass.Fields.get_Field(pFeatureLayer.FeatureClass.Fields.FindField("FID"));
                    }
                    else if (pFeatureLayer.FeatureClass.Fields.FindField("OBJECTID") != -1)
                    {
                        pField = pFeatureLayer.FeatureClass.Fields.get_Field(pFeatureLayer.FeatureClass.Fields.FindField("OBJECTID"));
                    }
                    //第一个属性字段名称
                    string       FirstFieldName = pField.AliasName;
                    IQueryFilter pQueryFilter   = new QueryFilterClass();
                    pQueryFilter.WhereClause = FirstFieldName + ">=0";
                    int number = pFeatureLayer.FeatureClass.FeatureCount(pQueryFilter);

                    IFeature pFeature;
                    if (FirstFieldName == "FID")
                    {
                        pFeature = pFeatureLayer.FeatureClass.GetFeature(number - 1);
                    }
                    else
                    {
                        pFeature = pFeatureLayer.FeatureClass.GetFeature(number);
                    }
                    IGeometry pGeometry = pFeature.Shape as IGeometry;
                    IPolyline pPolyline = pGeometry as IPolyline;

                    IPointCollection pPointCollection = new MultipointClass();
                    pPointCollection.AddPoint(pPolyline.ToPoint);

                    PointCollection.InsertPointCollection(0, pPointCollection);
                }
                else
                {
                    //不存在则创建新的线图层
                    CreateNewLineLayer();
                }

                //将所有的点连接成线
                IPolyline Polyline = CreatePolyline(PointCollection);

                //将连接成的线添加到线图层中
                AddFeature(Polyline as IGeometry);

                MessageBox.Show("成功生成中线");

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }