阅读:3417回复:12
在布局中添加指北针和比例尺问题(AO+VB)
<P>在布局中添加指北针和比例尺问题(AO+VB)</P>
<P><FONT color=#000080>Private Sub</FONT> cmdNorthArrow_Click() <CODE><FONT color=#008000>'Create a style selector and grab holf of the INorthArrowSelector interface</FONT></CODE> <CODE><FONT color=#000080>Set</FONT></CODE> m_pStyleSelector = <CODE><FONT color=#000080>New</FONT></CODE> NorthArrowSelector <CODE><FONT color=#008000>'Create an element</FONT></CODE> CreateElement m_pStyleSelector, CreateEnvelope(60, 315, 88, 287) <CODE><FONT color=#000080>End Sub Private Sub</FONT></CODE> cmdScaleBar_Click() <CODE><FONT color=#008000>'Create a style selector and grab holf of the IScaleBarSelector interface</FONT></CODE> <CODE><FONT color=#000080>Set</FONT></CODE> m_pStyleSelector = <CODE><FONT color=#000080>New</FONT></CODE> ScaleBarSelector <CODE><FONT color=#008000>'Create an element</FONT></CODE> CreateElement m_pStyleSelector, CreateEnvelope(88, 315, 158, 301) <CODE><FONT color=#000080>End Sub Public Sub CreateElement(pStyleSelector As IStyleSelector, pEnvelope As IEnvelope) m_bOK = m_pStyleSelector.DoModal(PageCtl.hWnd) ////////////////运行到此就出现错误,,,,,</FONT></CODE></P> <P><CODE><FONT color=#000080>end sub</FONT></CODE></P> <P><CODE><FONT color=#000080>不知道大家有没有遇到?怎么解决这个问题的?</FONT></CODE></P> <P><CODE></CODE> </P><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em07.gif" /><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em08.gif" /> |
|
1楼#
发布于:2005-03-28 13:21
<P>什么错误?这个对arcengine是没用的,你安装了arcgis ds?</P>
|
|
2楼#
发布于:2005-03-28 18:36
<P><FONT face=新宋体 color=#000080>我用的是AO8.3</FONT></P><P><FONT face=新宋体 color=#000080> m_bOK = m_pStyleSelector.DoModal(PageCtl.hWnd) </FONT></P><P><FONT face=新宋体 color=#000080>每次运行到这块使 m_bOK 的值是False ,不能显示m_pStyleSelector.DoModal对话框</FONT></P>
|
|
3楼#
发布于:2005-03-29 19:51
<P>是显示不出来,这需要自己做一个</P>
|
|
4楼#
发布于:2005-03-29 23:27
<P>得自己做整个对话框?</P><P>能不能把 North Arrow Properties 对话框调出来</P>
|
|
5楼#
发布于:2007-11-07 10:50
<P>呵 ,貌似这位仁兄以前做的东西和我现在做的东西差不多呢</P>
|
|
6楼#
发布于:2007-11-07 10:53
<P>还有pagelayout中输出文本时,</P>
<P> hr=pTextSymbolEditor->EditTextSymbol(;pTextSymbol,pwnd,;m_bok);</P> <P>在vb中可以,在vc中那个文本编辑对话框怎么出不来呢?</P> |
|
7楼#
发布于:2007-11-07 15:19
这个玩意,帮助例子里面有的。看例子代码就知道怎么收拾了的。
|
|
|
8楼#
发布于:2007-11-15 22:11
<P>在哪里呢,能不能给明地址呢?</P>
<P>先谢谢 </P> |
|
9楼#
发布于:2007-11-21 10:53
<PRE><CODE><FONT color=#0000ff>Public Sub</FONT></CODE> AddMapSurrounds()
<CODE><FONT color=#0000ff>Dim</FONT></CODE> pMxDoc <CODE><FONT color=#0000ff>As</FONT></CODE> IMxDocument <CODE><FONT color=#0000ff>Dim</FONT></CODE> pActiveView <CODE><FONT color=#0000ff>As</FONT></CODE> IActiveView <CODE><FONT color=#0000ff>Dim</FONT></CODE> pEnv <CODE><FONT color=#0000ff>As</FONT></CODE> IEnvelope <CODE><FONT color=#0000ff>Dim</FONT></CODE> pID <CODE><FONT color=#0000ff>As New</FONT></CODE> UID <CODE><FONT color=#0000ff>Dim</FONT></CODE> pMapSurround <CODE><FONT color=#0000ff>As</FONT></CODE> IMapSurround <CODE><FONT color=#0000ff>Dim</FONT></CODE> pMarkerNorthArrow <CODE><FONT color=#0000ff>As</FONT></CODE> IMarkerNorthArrow <CODE><FONT color=#0000ff>Dim</FONT></CODE> pCharacterMarkerSymbol <CODE><FONT color=#0000ff>As</FONT></CODE> ICharacterMarkerSymbol <CODE><FONT color=#0000ff>Set</FONT></CODE> pMxDoc = Application.Document <CODE><FONT color=#0000ff>Set</FONT></CODE> pActiveView = pMxDoc.PageLayout <CODE><FONT color=#0000ff>Set</FONT></CODE> pEnv = <CODE><FONT color=#0000ff>New</FONT></CODE> Envelope <CODE><FONT color=#008000>'Add a north arrow</FONT></CODE> pEnv.PutCoords 0.2, 0.2, 1, 1 pID.Value = "esriCarto.MarkerNorthArrow" <CODE><FONT color=#0000ff>Set</FONT></CODE> pMapSurround = CreateSurround(pID, pEnv, "North Arrow", pMxDoc.FocusMap, pMxDoc.PageLayout) <CODE><FONT color=#008000>'Change out the default north arrow</FONT></CODE> <CODE><FONT color=#0000ff>Set</FONT></CODE> pMarkerNorthArrow = pMapSurround <CODE><FONT color=#008000>'QI</FONT></CODE> <CODE><FONT color=#0000ff>Set</FONT></CODE> pCharacterMarkerSymbol = pMarkerNorthArrow.MarkerSymbol <CODE><FONT color=#008000>'clones the symbol</FONT></CODE> pCharacterMarkerSymbol.CharacterIndex = 200 <CODE><FONT color=#008000>'change the symbol</FONT></CODE> pMarkerNorthArrow.MarkerSymbol = pCharacterMarkerSymbol <CODE><FONT color=#008000>'set it back</FONT></CODE> <CODE><FONT color=#008000>'Add a </FONT><FONT style="BACKGROUND-COLOR: #0a246a" color=#ffffff>legend</FONT></CODE> <CODE><FONT color=#008000>'In this case just use the default </FONT><FONT style="BACKGROUND-COLOR: #0a246a" color=#ffffff>legend</FONT></CODE> pEnv.PutCoords 1, 1, 3.4, 2.4 pID.Value = "esriCarto.<FONT style="BACKGROUND-COLOR: #0a246a" color=#ffffff>Legend</FONT>" <CODE><FONT color=#0000ff>Set</FONT></CODE> pMapSurround = CreateSurround(pID, pEnv, "<FONT style="BACKGROUND-COLOR: #0a246a" color=#ffffff>Legend</FONT>", pMxDoc.FocusMap, pMxDoc.PageLayout) <CODE><FONT color=#008000>'Refresh the graphics</FONT></CODE> pActiveView.PartialRefresh esriViewGraphics, <CODE><FONT color=#0000ff>Nothing</FONT></CODE>, <CODE><FONT color=#0000ff>Nothing End Sub Private Function</FONT></CODE> CreateSurround(pID <CODE><FONT color=#0000ff>As</FONT></CODE> UID, pEnv <CODE><FONT color=#0000ff>As</FONT></CODE> IEnvelope, strName <CODE><FONT color=#0000ff>As String</FONT></CODE>, _ pMap <CODE><FONT color=#0000ff>As</FONT></CODE> IMap, pPageLayout <CODE><FONT color=#0000ff>As</FONT></CODE> IPageLayout) <CODE><FONT color=#0000ff>As</FONT></CODE> IMapSurround <CODE><FONT color=#0000ff>Dim</FONT></CODE> pGraphicsContainer <CODE><FONT color=#0000ff>As</FONT></CODE> IGraphicsContainer <CODE><FONT color=#0000ff>Dim</FONT></CODE> pActiveView <CODE><FONT color=#0000ff>As</FONT></CODE> IActiveView <CODE><FONT color=#0000ff>Dim</FONT></CODE> pMapSurroundFrame <CODE><FONT color=#0000ff>As</FONT></CODE> IMapSurroundFrame <CODE><FONT color=#0000ff>Dim</FONT></CODE> pMapSurround <CODE><FONT color=#0000ff>As</FONT></CODE> IMapSurround <CODE><FONT color=#0000ff>Dim</FONT></CODE> pMapFrame <CODE><FONT color=#0000ff>As</FONT></CODE> IMapFrame <CODE><FONT color=#0000ff>Dim</FONT></CODE> pElement <CODE><FONT color=#0000ff>As</FONT></CODE> IElement <CODE><FONT color=#008000>'MapSurrounds are held in a MapSurroundFrame</FONT></CODE> <CODE><FONT color=#008000>'MapSurroundFrames are related to MapFrames</FONT></CODE> <CODE><FONT color=#008000>'MapFrames hold Maps</FONT></CODE> <CODE><FONT color=#0000ff>Set</FONT></CODE> pGraphicsContainer = pPageLayout <CODE><FONT color=#0000ff>Set</FONT></CODE> pMapFrame = pGraphicsContainer.FindFrame(pMap) <CODE><FONT color=#0000ff>Set</FONT></CODE> pMapSurroundFrame = pMapFrame.CreateSurroundFrame(pID, <CODE><FONT color=#0000ff>Nothing</FONT></CODE>) pMapSurroundFrame.MapSurround.Name = strName <CODE><FONT color=#008000>'Set the geometry of the MapSurroundFrame to give it a location</FONT></CODE> <CODE><FONT color=#008000>'Activate it and add it to the PageLayout's graphics container</FONT></CODE> <CODE><FONT color=#0000ff>Set</FONT></CODE> pElement = pMapSurroundFrame <CODE><FONT color=#0000ff>Set</FONT></CODE> pActiveView = pPageLayout pElement.Geometry = pEnv pElement.Activate pActiveView.ScreenDisplay <CODE><FONT color=#008000>'Allow the </FONT><FONT style="BACKGROUND-COLOR: #0a246a" color=#ffffff>legend</FONT><FONT color=#008000> frame size to be altered after the </FONT><FONT style="BACKGROUND-COLOR: #0a246a" color=#ffffff>legend</FONT><FONT color=#008000> has been</FONT></CODE> <CODE><FONT color=#008000>'added to the GraphicsContainer </FONT></CODE> <CODE><FONT color=#0000ff>Dim</FONT></CODE> PTrack <CODE><FONT color=#0000ff>As</FONT></CODE> ITrackCancel <CODE><FONT color=#0000ff>Set</FONT></CODE> PTrack = <CODE><FONT color=#0000ff>New</FONT></CODE> CancelTracker pElement.Draw pActiveView.ScreenDisplay, PTrack pGraphicsContainer.AddElement pElement, 0 <CODE><FONT color=#008000>'Re-apply the change to the </FONT><FONT style="BACKGROUND-COLOR: #0a246a" color=#ffffff>Legend</FONT><FONT color=#008000> MapSurroundFrame Geometry </FONT></CODE> pElement.Geometry = pEnv <CODE><FONT color=#0000ff>Set</FONT></CODE> CreateSurround = pMapSurroundFrame.MapSurround <CODE><FONT color=#0000ff>End Function</FONT></CODE> </PRE> |
|
|
上一页
下一页