Pergunta

I have a WPF app which hosts a WindowsFormHost. The WindowsFormHost loads ESRI's ArcEngine. The ArcEngine has some drawing functions available but I'm looking for more power and control. Assuming I want to draw some images & text on the screen over the image created by the ArcEngine, what are my options, if any?

Foi útil?

Solução

A WPF window cant render anything over any winforms elements that it contains. You either need to do the drawing within the winforms element or do a nasty hack of creating a separate WPF window with a transparent background & no border that you programatically move around to keep on top of the winforms element - then you can draw into this overlay window using WPF mechanisms. it's ugly but effective.

Outras dicas

You can implement your Custom Layer. Inside the layer you can implement your drawing method with GDI+ or OpenGL (in Dynamic Display mode).

Create class that implements ILayer interface. In this case you can to manage your drawing as you wish. There is an exmaple of simple implementation with GDI+

[Guid("0c745c09-a67a-4736-ba8c-23238582f78f")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("CustomLayerPan.customLayer")]

public class customLayer : ESRI.ArcGIS.ADF.BaseClasses
{
    public customLayer(List<IGeometry> p_objItems)
    {           
    }

    public override void Draw(ESRI.ArcGIS.esriSystem.esriDrawPhase drawPhase, ESRI.ArcGIS.Display.IDisplay Display, ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel)
    {
        Graphics objGraphics = Graphics.FromHdc(new IntPtr(((IScreenDisplay)Display).hDC)) as Graphics;
         //Draw here using GDI+          
    }
}   
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top