IRasterLayer pDEMRLayer = axMapControl1.get_Layer(1) as IRasterLayer;
IRaster pDEMR = pDEMRLayer.Raster;
IRasterProps pRasterProps = (IRasterProps)(pDEMRLayer.Raster);
//存储每个栅格的X坐标和Y坐标
double blockX = pRasterProps.MeanCellSize().X;
double blockY = pRasterProps.MeanCellSize().Y;
//栅格数据左上角栅格的空间坐标
double Xm = pRasterProps.Extent.XMin + blockX / 2;
double Ym = pRasterProps.Extent.YMin + blockX / 2;
int dHeight = pRasterProps.Height;//当前栅格数据集的行数
int dWidth = pRasterProps.Width; //当前栅格数据集的列数
IPnt pnt = new PntClass();
//读取栅格信息
pnt.SetCoords(0, 0);//0,0取值窗口的起始位置在原栅格数据上的位置
IPnt pntSize = new PntClass();
pntSize.SetCoords(dWidth, dHeight);//设置取值窗口的行列,注意这里是先列后行
IPixelBlock pixelBlock = pDEMR.CreatePixelBlock(pntSize);//生成像素块
pDEMR.Read(pnt, pixelBlock);
List<IPoint> depthList = new List<IPoint>();
for (int i = 0; i < dHeight; i++)
for (int j = 0; j < dWidth; j++)
{
object obj = Convert.ToDouble(pixelBlock.GetVal(0, i, j));
}