Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try to access the hDC of my dynamic layer the result is always 0. Is there a way to get a non zero hDC from a layer that inherits BaseDynamicLayer?

public class BalloonCalloutLayer : BaseDynamicLayer
    public override void DrawDynamicLayer(
        esriDynamicDrawPhase DynamicDrawPhase, 
        IDisplay display, 
        IDynamicDisplay dynamicDisplay)
        int hdc = display.hDC; // This is always 0
share|improve this question
Why are you needing the hDC? Not sure but when this gets called OpenGL has been initialized and is ready for OpenGL drawing requests. If you aren't using the dynamic display, have you tried overriding ILayer.Draw instead? – Kirk Kuykendall Jul 14 '11 at 16:17
@Kirk Kuykendall Well for this example, I am using the DynamicDisplay. Right now I'm drawing hover ballons with an invisible top window because of the issue with balloon callouts in DD they look like this, so I thought I'd use GDI+ instead. – patrick Jul 14 '11 at 16:27
Yeah, those DD labels look bad. Still, GDI+ sure will slow you down. Have you looked into DD with MOLE? The military usually has the resources to figure this stuff out. – Kirk Kuykendall Jul 14 '11 at 17:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.