jgiesler

IcustomOverlayGrid

Discussion created by jgiesler on Mar 30, 2011
Hi Everyone,
I am trying to create a custom grid using IcustomOverlayGrid.  I can get it to create the grid in the data frame properties but I can't get it to draw.  I try refreshing that does nothing.  I try the .draw command and I error.  I am sure this is the problem but I can't figure it out.
Below is the code I know work with out the drawing.  Any help or suggestion would be great.
Cheers,
Jeff

ICustomOverlayGrid MG = new CustomOverlayGridClass();
MG.DataSource = TwpFC;
MG.Name =
"Township Grid";
//Set color
IColor tickcolor = new RgbColorClass();
tickcolor.RGB =
Color.White.ToArgb();
// set tick properties
MG.TickLength = 15;
ICartographicLineSymbol cartographicLineSymbol = new CartographicLineSymbolClass();
cartographicLineSymbol.Cap =
esriLineCapStyle.esriLCSRound;
cartographicLineSymbol.Width = 1;
cartographicLineSymbol.Color = tickcolor;
MG.TickLineSymbol = cartographicLineSymbol
as ILineSymbol;
MG.TickMarkSymbol =
null;
MG.Border =
null;
MG.SetTickVisibility(
true, true, true, true);
MG.Visible =
true;

// Add gird to map
IGraphicsContainer gcontainer = PGLO as IGraphicsContainer;
IFrameElement FE = gcontainer.FindFrame(map);
IMapFrame MF = FE as IMapFrame;
IMapGrids MapGrids = null;
MapGrids = MF
as IMapGrids;
MapGrids.AddMapGrid(MG);
IActiveView AV = mxDoc.ActiveView;
AV.PartialRefresh(
esriViewDrawPhase.esriViewBackground, null, null);

Outcomes