private void showText(double x, double y)
{
IGraphicsContainer graphicsContainer = axMapControl1.Map as IGraphicsContainer;
IElement element = new TextElementClass();
ITextElement textElement = element as ITextElement;
//Create a point as the shape of the element.
IPoint point = new PointClass();
point.X = x;
point.Y = y;
element.Geometry = point;
textElement.Text = "Hello World";
graphicsContainer.AddElement(element, 0);
//Flag the new text to invalidate.
IActiveView activeView = axMapControl1.Map as IActiveView;
activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
} private void createPictureElement(double x, double y) {
ESRI.ArcGIS.Carto.IPictureElement pPictureElement;
pPictureElement = new ESRI.ArcGIS.Carto.JpgPictureElementClass();
pPictureElement.ImportPictureFromFile(@"D:\__VS\�?конки\�?н�? заболевания л�?дей.JPG");
//((IElement)pPictureElement)..
ESRI.ArcGIS.Geometry.IEnvelope pEnv = new ESRI.ArcGIS.Geometry.EnvelopeClass();
pEnv.PutCoords(x, y, x+1000,y+1000);
ESRI.ArcGIS.Carto.IElement pElement;
pElement = pPictureElement as ESRI.ArcGIS.Carto.IElement;
pElement.Geometry = pEnv;
ESRI.ArcGIS.Carto.IGraphicsContainer pGraphicContainer;
pGraphicContainer = axMapControl1.Map as IGraphicsContainer;
pGraphicContainer.AddElement(pElement, 0);
ESRI.ArcGIS.Carto.IActiveView pActiveView;
pActiveView = pGraphicContainer as ESRI.ArcGIS.Carto.IActiveView;
pActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGraphics, pElement, pEnv);
}((IOlePictureElement)pPictureElement).ImportPicture(IPictureDispHost.GetIPictureDispFromPicture(pictureBox.Image) as stdole.IPictureDisp);
internal sealed class IPictureDispHost : AxHost
{
private IPictureDispHost() : base("{63109182-966B-4e3c-A8B2-8BC4A88D221C}") { }
/// <summary>
/// Convert the image to an ipicturedisp.
/// </summary>
/// <param name="image">The image instance</param>
/// <returns>The picture dispatch object.</returns>
public new static object GetIPictureDispFromPicture(Image image)
{
return AxHost.GetIPictureDispFromPicture(image);
}
/// <summary>
/// Convert the dispatch interface into an image object.
/// </summary>
/// <param name="picture">The picture interface</param>
/// <returns>An image instance.</returns>
public new static Image GetPictureFromIPicture(object picture)
{
return AxHost.GetPictureFromIPicture(picture);
}
}