|
阅读:1562回复:3
IPageLayoutControl 接口
<P>在vb.net中IPageLayoutControl .AddElement(pElement,Geometry,Symbology,Name,ZOrder)后面三个参数可以省略,但在C#中必须写。。。。。。我想把MapControl 中的Map传给PageLayoutControl中间把MapFrame做为个pElement加入,在vb.net中已经可以,但在C#中后面的参数出错,请教高手指点。。。。。。。。。</P><img src="images/post/smile/dvbbs/em12.gif" /><img src="images/post/smile/dvbbs/em12.gif" /><img src="images/post/smile/dvbbs/em12.gif" /><img src="images/post/smile/dvbbs/em12.gif" /><img src="images/post/smile/dvbbs/em12.gif" />
|
|
|
1楼#
发布于:2004-10-27 21:43
<P>axPageLayoutControl.AddElement不行的地方可以试试得到IGraphicContainer对象,然后用 IGraphicContainer.AddElement(pElement,0)只要两个参数,很好用,我的指北针,比例尺都是用它加的</P>
|
|
|
2楼#
发布于:2004-09-11 21:50
<P>我这样试过。还是不行</P><P>IMapFrame ipMapFrame = new MapFrameClass();
ipMapFrame.Map = ipMapControl.Map; IElement ipElement = ipMapFrame as IElement; IEnvelope ipEnv = null; ipEnv = axPageLayoutControl.Extent; IRgbColor ipRgbColor = new RgbColorClass(); </P> <P>ipRgbColor.Red = 255; string strName = "FF"; <FONT color=#ee11c2>其中这几种都不行:</FONT> (a)、axPageLayoutControl.AddElement(ipElement,ipEnv as object,ipRgbColor as object,strName as object,1); (b)、axPageLayoutControl.AddElement(ipElement,ipEnv,ipRgbColor ,strName ,1); (c)、axPageLayoutControl.AddElement(ipElement,ipEnv,ipRgbColor,null,1);</P> |
|
|
3楼#
发布于:2004-09-10 15:01
<P>private void axPageLayoutControl1_OnMouseDown(object sender, ESRI.ArcGIS.PageLayoutControl.IPageLayoutControlEvents_OnMouseDownEvent e)
{ IRgbColor rgbColor = new RgbColorClass(); rgbColor.Red = 255; axPageLayoutControl1.AddElement(new RectangleElement(), axPageLayoutControl1.TrackRectangle(), rgbColor,null,-1); axPageLayoutControl1.CtlRefresh(esriViewDrawPhase.esriViewGraphics,null,null); } [Visual Basic 6.0] The following code example adds a new element that implements IEnvelope and is colored Red.</P><P>Private Sub PageLayoutControl1_OnMouseDown (ByVal _ button As Long, ByVal shift As Long, ByVal x As Long, ByVal _ y As Long, ByVal pageX As Double, ByVal pageY As Double) Dim pRgbColor As IRgbColor Set pRgbColor = New RgbColor pRgbColor.Red = 255 PageLayoutControl1.AddElement New RectangleElement, _ PageLayoutControl1.TrackRectangle,pRgbColor PageLayoutControl1.Refresh esriViewGraphics</P><P>End Sub [Visual Basic .NET] The following code example adds a new element that implements IEnvelope and is colored Red.</P><P>Private Sub AxPageLayoutControl1_OnMouseDown(ByVal sender As System.Object, ByVal e As ESRI.ArcGIS.PageLayoutControl.IPageLayoutControlEvents_OnMouseDownEvent) Handles AxPageLayoutControl1.OnMouseDown Dim pRgbColor As IRgbColor pRgbColor = New RgbColor pRgbColor.Red = 255 AxPageLayoutControl1.AddElement(New RectangleElement, AxPageLayoutControl1.TrackRectangle, pRgbColor) AxPageLayoutControl1.CtlRefresh(esriViewDrawPhase.esriViewGraphics) End Sub 这是在线帮助中的。</P> |
|
|