Delphi ArcEngine 向Mapcontrol和PageControl添加位图方法

function InsertImage(pActiveView:IActiveView; pEnvelope: IEnvelope; sBmpFile: string): Boolean;

//参数依次为 活动视图(可以是Mapcontrol或PageControl的ActiveView),绘制范围,位图文件名称的全路径

//调用方法 举例 InsertImage(MapControl1.ActiveView,MapControl1.ActiveView.Extent,'d:"snap1.bmp');

var

   pGrahpicsContainer: IGraphicsContainer ;
   pBmpPictrue:IPictureElement;
   pElement:IElement;
begin
   pBmpPictrue:= CoBmpPictureElement.Create as IPictureElement;
   pBmpPictrue.ImportPictureFromFile(sBmpFile);
   pBmpPictrue.MaintainAspectRatio:= True;

   pElement := pBmpPictrue as IElement;
   pElement.Geometry:= pEnvelope;

   pGrahpicsContainer := pActiveView as IGraphicsContainer;
   pGrahpicsContainer.DeleteAllElements;
   pGrahpicsContainer.AddElement(pElement,0);

   pActiveView.PartialRefresh(esriViewGraphics,nil,pActiveView.Extent);

   Result := true;
end;
原文地址:https://www.cnblogs.com/chinacodegear/p/1420491.html