xufgis
路人甲
路人甲
  • 注册日期2007-09-21
  • 发帖数2
  • QQ
  • 铜币115枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1604回复:2

求教:直线怎么也画不出来_ArcEngine_C#

楼主#
更多 发布于:2007-10-26 01:23
<P>刚学AO,我想在地图上通过两个点画一条线,这些点坐标都是从我的鼠标坐标得来。但是在代码 pEle.Geometry = line as IGeometry; 那个地方总是抱错:alue does not fall within the expected range, 请大侠指导,谢谢。具体代码块如下</P>
<P><BR>                    IPoint pt2 = new PointClass();<BR>                    pt2.X = e.mapX;<BR>                    pt2.Y = e.mapY;<BR>                    ILineElement pline = new LineElementClass();<BR>                    ILineSymbol sym = new SimpleLineSymbolClass();<BR>                    sym.Color.RGB = Color.Blue.ToArgb();<BR>                    sym.Width = 10;<BR>                    pline.Symbol = sym;</P>
<P>                    ILine2 line = new LineClass();<BR>                    line.PutCoords(pt, pt2);   //pt也是IPoint类型</P>
<P>                    IElement pEle = pline as IElement;<BR>                    pEle.Geometry = line as IGeometry;</P>
<P>                    pmap.AddElement((IElement)pline, 0);   //出错<BR>                    m_mapControl.ActiveView.PartialRefresh(...);</P>
喜欢0 评分0
tanyg
路人甲
路人甲
  • 注册日期2005-04-26
  • 发帖数5
  • QQ
  • 铜币191枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-10-31 12:38
alue does not fall within the expected range<br>你的坐标超出建库是的bounds了吧?!<br><br>
举报 回复(0) 喜欢(0)     评分
小波变换
路人甲
路人甲
  • 注册日期2007-06-20
  • 发帖数64
  • QQ
  • 铜币58枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2007-10-31 16:07
<P>我觉得应该是:</P>
<P>IElement pEle = new LineElementClass();</P>
<P>pEle.Geometry = line as IGeometry;</P>
<P>pmap.AddElement(pEle, 0);                          </P>
********************************** 喜欢有激情的生活 msn:hou.jiazte@hotmail.com 欢迎交流 **********************************
举报 回复(0) 喜欢(0)     评分
游客

返回顶部