AE中添加shp文件的问题!

这段代码有问题吗?可以生成解决方案,但是还是不能加载shp文件啊。报错显示

图片说明

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;

namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void addShapeFile()
{
System.Windows.Forms.OpenFileDialog openFileDialog;
openFileDialog = new OpenFileDialog();
openFileDialog.Title = "打开图层文件";
openFileDialog.Filter = "map documents(*.shp)|*.shp";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
FileInfo fileInfo = new FileInfo(openFileDialog.FileName);
String path = fileInfo.Directory.ToString();
String fileName = fileInfo.Name.Substring(0, fileInfo.Name.IndexOf("."));
try
{
axMapControl1.AddShapeFile(path, fileName);
}
catch (Exception e)
{
MessageBox.Show("添加图层失败!!!" + e.ToString());
}
}
}
private void button1_Click(object sender, EventArgs e)
{
addShapeFile();

    }
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问