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 have a Customer layer which inherits BaseCustomLayer.

I add it to my MapControl via addLayer but the function public override void Draw(esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel) is never hit.

The Custom Layer appears checked in the TOC.

I think I must be missing some initialization one-liner.

share|improve this question
up vote 6 down vote accepted

Here's a minimalist custom layer:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.esriSystem;

namespace MapControlApplication1
    class CustLayer2: BaseCustomLayer
        public override void Draw(esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
            System.Diagnostics.Debug.Print("drawing {0} {1}", drawPhase,  Environment.TickCount);

I created a new Project and choosing C#>ArcGIS>Extending ArcObjects>Mapcontrol Application, then added a new menuitem on the menu of MainForm with this:

private void testToolStripMenuItem_Click(object sender, EventArgs e)
        CustLayer2 layer = new CustLayer2();
        layer.Name = "cust layer2";
    catch (Exception ex)
        MessageBox.Show(this, ex.Message);

When I run I see this output as I pan around the map:

drawing esriDPGeography 441416029
drawing esriDPGeography 441422207
drawing esriDPGeography 441433579
share|improve this answer
I had "dynamicMap.DynamicMapEnabled = true;" which was interferring with your example. Thanks for all your help. – patrick Sep 1 '10 at 16:28
Ahh, that makes sense. For a custom layer to draw when the dynamicmap is enabled, I think you'll need to implement IDynamicLayer too.… – Kirk Kuykendall Sep 1 '10 at 17:13

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.