ArcEngine开发问题总结
问题:遇到'异常来自 HRESULT:0x80040228’
解决方法:添加一个license控件就行了.
参考:http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=14967
问题:遇到‘ArcGIS version not specified. You must call RuntimeManager.Bind before creating any ArcGIS components.’
解决方法:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
/// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { //添加一下语句 ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
问题:
解决办法:
将嵌入互操作类型设置为false。
问题:如何利用点连接成线
解决代码
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 IPoint pPoint1; 2 IPoint pPoint2; 3 pPoint1 = new PointClass(); 4 pPoint1.PutCoords(100, 20); 5 pPoint1.Z = 80; 6 pPoint2 = new PointClass(); 7 pPoint2.PutCoords(20, 310); 8 pPoint2.Z = 100; 9 IGeometryCollection pPolyline; 10 pPolyline = new PolylineClass(); 11 ISegmentCollection pPath; 12 pPath = new PathClass(); 13 ILine pLine; 14 object Missing1 = Type.Missing; 15 object Missing2 = Type.Missing; 16 pLine = new LineClass(); 17 pLine.PutCoords(pPoint1, pPoint2); 18 pPath.AddSegment(pLine as ISegment, ref Missing1, ref Missing2); 19 pPolyline.AddGeometry(pPath as IGeometry, ref Missing1, ref Missing2); 20 IPoint pPoint3; 21 IPoint pPoint4; 22 pPoint3 = new PointClass(); 23 pPoint3.PutCoords(1100, 20); 24 pPoint3.Z = 80; 25 pPoint4 = new PointClass(); 26 pPoint4.PutCoords(210, 310); 27 pPoint4.Z = 100; 28 IGeometryCollection pPolyline1; 29 pPolyline1 = new PolylineClass(); 30 ISegmentCollection pPath1; 31 pPath1 = new PathClass(); 32 ILine pLine1; 33 34 pLine1 = new LineClass(); 35 pLine1.PutCoords(pPoint3, pPoint4); 36 pPath1.AddSegment(pLine1 as ISegment, ref Missing1, ref Missing2); 37 pPolyline.AddGeometry(pPath1 as IGeometry, ref Missing1, ref Missing2); 38 IPolyline polygon=(IPolyline)pPolyline; 39 object o = null; 40 //axMapControl1.DrawShape 41 axMapControl1.DrawShape(polygon, ref o);
参考:兰小机 刘德儿