Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

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

I'm experimenting with the idea of replacing my dynamic display moving graphics with the static (DynamicDisplayEnabled = false) moving graphics.

public class CustomLayer : BaseCustomLayer
        public override void Draw(esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
            int hdc = Display.hDC;
            IntPtr p = new IntPtr(hdc);
            Graphics graphics = Graphics.FromHdc(p);
            Image newImage = Image.FromFile(carImage);
            System.Drawing.Point ulCorner = new System.Drawing.Point(x, y);
            graphics.DrawImage(newImage, ulCorner);

This code draws the image, but it only invokes draw once, unless I move the map with the pan tool or change the scale. How can I make the Draw function fire multiple times a second?

share|improve this question
Not an answer but just something you might want to try if the screen just isn't updating as you expect: call IScreenDisplay.UpdateWindow to force the window to respond to any pending WM_PAINT messages. Things weren't drawing in the expected order for me without a call to that after IActiveView.Refresh but before my StartDrawing/EndDrawing section. – blah238 Jul 12 '11 at 3:33
up vote 1 down vote accepted

It's been a while, but when I was working on a project for vehicle tracking I think we used a timer in conjunction with Dispatcher.CurrentDispatcher to force a refresh. See this answer on using CurrentDispatcher.

I think we checked to make sure IViewRefresh.Drawing was false before calling refresh, but I think there were issues with that.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.