public static void addPictureElement(AxPageLayoutControl axPageLayoutControl, string fileName)
{
//创建PageLayout对象
IPageLayout pPageLayout = axPageLayoutControl.PageLayout;
//将PageLayout强转成IActiveView
IGraphicsContainer pGraphicsContainer = (IGraphicsContainer)pPageLayout;
IActiveView pActiveView = (IActiveView)pPageLayout;
IPictureElement pPictureElement = new PngPictureElementClass();
pPictureElement.ImportPictureFromFile(fileName);
//图片在缩放的时候长宽保持比例
pPictureElement.MaintainAspectRatio = true;
//添加图片的附加描述信息
//string ms=pPictureElement.PictureDescription ;
//确定这张图片是否会被保存到mxd上
//pPictureElement.SavePictureInDocument = true;
IFrameElement pFrameElement = axPageLayoutControl.GraphicsContainer.FindFrame(axPageLayoutControl.ActiveView.FocusMap);
IElement pElement;
pElement = pFrameElement as IElement;
IEnvelope pEnvelop = pElement.Geometry.Envelope;
IElement pElementPic = pPictureElement as IElement;
IEnvelope pEnvelopNew = new EnvelopeClass();
pEnvelopNew.XMin = 0;
pEnvelopNew.YMin = pEnvelop.YMin - 10;
pEnvelopNew.XMax = 7.1438;
pEnvelopNew.YMax = pElementPic.Geometry.Envelope.YMax;
//pEnvelopNew = pElementPic.Geometry.Envelope;
//确定原始的Geometry属性,它是一个矩形
pElementPic.Geometry = pEnvelopNew;//(IGeometry)point;// pEnvelope;
pGraphicsContainer.AddElement(pElementPic, -10);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
——————————————————————————————
可实现插入图片功能,但图片大小、位置控制方面还需要调整!