ILayer pLayer = pAxMapControl.get_Layer(this.cmbLayer.SelectedIndex);
IRasterLayer pRasterLayer = pLayer as IRasterLayer;
IWorkspaceFactory2 pWorkspaceFactory2 = new RasterWorkspaceFactoryClass();
IRasterWorkspace pRasterWorkspace;
int Index = pRasterLayer.FilePath.LastIndexOf("\\");
string filePath = pRasterLayer.FilePath.Substring(0, Index);
string fileName = pRasterLayer.FilePath.Substring(Index + 1);
pRasterWorkspace = (IRasterWorkspace)pWorkspaceFactory2.OpenFromFile(filePath, 0);
IRasterDataset pRasterDataset = pRasterWorkspace.OpenRasterDataset(fileName);
IGeoDataset pRasterGeoDataset = pRasterDataset as IGeoDataset;
IWorkspaceFactory2 pWorkspaceFactoryShp = new ShapefileWorkspaceFactoryClass();
//............................................................................
IWorkspace pWorkspace = pWorkspaceFactoryShp.OpenFromFile(this.tbFolderPath.Text, 0);
IConversionOp pConversionOp = new RasterConversionOpClass();
ISpatialReference pSpatialReference = pRasterGeoDataset.SpatialReference;
IGeoDataset pGeoDataset;
//....................................................................
pGeoDataset = pConversionOp.RasterDataToPolygonFeatureData(pRasterGeoDataset, pWorkspace, this.tbName.Text, true);
IDataset pDataset1 = pGeoDataset as IDataset;
IFeatureClass pFeatureClass = pDataset1 as IFeatureClass;
IFeatureLayer pFeatureLayer = new FeatureLayerClass();
pFeatureLayer.FeatureClass = pFeatureClass;
pAxMapControl.ClearLayers();
pAxMapControl.AddLayer(pFeatureLayer);
pAxMapControl.Refresh();
IRasterLayer pRasterLayer = pLayer as IRasterLayer;
IWorkspaceFactory2 pWorkspaceFactory2 = new RasterWorkspaceFactoryClass();
IRasterWorkspace pRasterWorkspace;
int Index = pRasterLayer.FilePath.LastIndexOf("\\");
string filePath = pRasterLayer.FilePath.Substring(0, Index);
string fileName = pRasterLayer.FilePath.Substring(Index + 1);
pRasterWorkspace = (IRasterWorkspace)pWorkspaceFactory2.OpenFromFile(filePath, 0);
IRasterDataset pRasterDataset = pRasterWorkspace.OpenRasterDataset(fileName);
IGeoDataset pRasterGeoDataset = pRasterDataset as IGeoDataset;
IWorkspaceFactory2 pWorkspaceFactoryShp = new ShapefileWorkspaceFactoryClass();
//............................................................................
IWorkspace pWorkspace = pWorkspaceFactoryShp.OpenFromFile(this.tbFolderPath.Text, 0);
IConversionOp pConversionOp = new RasterConversionOpClass();
ISpatialReference pSpatialReference = pRasterGeoDataset.SpatialReference;
IGeoDataset pGeoDataset;
//....................................................................
pGeoDataset = pConversionOp.RasterDataToPolygonFeatureData(pRasterGeoDataset, pWorkspace, this.tbName.Text, true);
IDataset pDataset1 = pGeoDataset as IDataset;
IFeatureClass pFeatureClass = pDataset1 as IFeatureClass;
IFeatureLayer pFeatureLayer = new FeatureLayerClass();
pFeatureLayer.FeatureClass = pFeatureClass;
pAxMapControl.ClearLayers();
pAxMapControl.AddLayer(pFeatureLayer);
pAxMapControl.Refresh();