|
阅读:1473回复:0
设置PageLayoutControl的GRID样式为何导致程序崩溃?
<P>函数如下,不知哪里出了问题:</P>
<P> private void Grid(object sender, EventArgs e)<BR> {<BR> IActiveView pActiveView;<BR> IGraphicsContainer pGraphicsContainer;<BR> IMapFrame pMapFrame;<BR> IMap pMap;<BR> pActiveView = axPageLayoutControl1.ActiveView as IActiveView;<BR> pMap = pActiveView.FocusMap;<BR> pGraphicsContainer = pActiveView as IGraphicsContainer;<BR> pMapFrame = pGraphicsContainer.FindFrame(pMap) as IMapFrame;<BR> IStyleSelector pStyleSelector;<BR> pStyleSelector = new MapGridSelectorClass();<BR> bool m_bOK;<BR> m_bOK = pStyleSelector.DoModal(axPageLayoutControl1.hWnd);<BR> if (!m_bOK) return;<BR> IMapGrid pMapGrid;<BR> pMapGrid = pStyleSelector.GetStyle(0) as IMapGrid;<BR> IMapGrids pMapGrids;<BR> pMapGrids = pMapFrame as IMapGrids;<BR> <BR> pMapGrids.ClearMapGrids();<BR> if (pMapGrid != null)<BR> {<BR> <BR> pMapGrids.AddMapGrid(pMapGrid);<BR> }<BR> axPageLayoutControl1.Refresh(esriViewDrawPhase.esriViewBackground, null, null);<BR> }</P> <P>请高手指点!!</P> |
|