Example #1
0
        private void miCreatShapefile_Click(object sender, EventArgs e)
        {
            DataOperator  dataOperator = new DataOperator(axMapControl1.Map);
            IFeatureClass featureClass = dataOperator.CreateShapefile("F:\\ProjectFiles\\GIS\\MapControlApplication111", "ShapefileWorkSpace", "ShapefileSample");

            if (featureClass == null)
            {
                MessageBox.Show("创建Shape文件失败");
                return;
            }
            bool bRes = dataOperator.AddFeatureClassToMap(featureClass, "Observation Stations");

            if (bRes)
            {
                miCreateShapefile.Enabled = false;
                miAddFeature.Enabled      = true;
                return;
            }
            else
            {
                MessageBox.Show("将新建的Shape文件加入地图失败");
            }
        }