this.openFileDialog1.Filter = "图像数据(*.tif,*.jpg,*.bmp,*.gif)|*.tif;*.jpg;*.bmp;*.gif";
this.openFileDialog1.Title = "打开影像数据";
this.openFileDialog1.Multiselect = false;
string fileName = "";
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
fileName = this.openFileDialog1.FileName;
string filepath;
string file;
string file1;
int lastIndex;
lastIndex = fileName.LastIndexOf(@"");
filepath = fileName.Substring(0, lastIndex);
file = fileName.Substring(lastIndex + 1);
//导入SDE数据库
rasterWorkspaceEx = workspace as IRasterWorkspaceEx;
IWorkspaceFactory tifwpf = new RasterWorkspaceFactoryClass();
IWorkspace tifwp = tifwpf.OpenFromFile(filepath, 0);
IRasterWorkspace tifrwp = tifwp as IRasterWorkspace;
IRasterDataset rasterDataset = tifrwp.OpenRasterDataset(file);
lastIndex = file.LastIndexOf(@".");
file1 = file.Substring(0, lastIndex);
imortRasterData(filepath, file, file1);
MessageBox.Show("导入成功");
不知道怎么解决这个问题,感谢解答!!