首页 > 代码库 > ArcGIS “Error HRESULT E_FAIL has been returned from a call to a COM component.” 异常的解决
ArcGIS “Error HRESULT E_FAIL has been returned from a call to a COM component.” 异常的解决
错误提示内容:
{System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at ESRI.ArcGIS.Display.AlgorithmicColorRampClass.CreateRamp(Boolean& ok) ...
写了一个简单的函数:
public IColorRamp CreateColorRamp(IColor fromColor, IColor toColor, int count){ IAlgorithmicColorRamp pRampColor; bool ok = true; pRampColor = new AlgorithmicColorRampClass(); pRampColor.FromColor = fromColor; pRampColor.ToColor = toColor; // ... missing size sentence pRampColor.CreateRamp(out ok); return pRampColor as IColorRamp;}
后来仔细检查代码,发现在以上黄色语句处少了pRampColor.Size = count;这句话,导致创建彩色条带的失败。但是仅仅给出“Error HRESULT E_FAIL has been returned from a call to a COM component.”这样的错误,我对ArcGIS的异常提示也是醉了,鬼知道这是什么错误。所以说在不考虑ArcGIS那几处优秀的设计地方外,可以说ArcGIS这个系统软件做的十分烂。
备注一下,省的以后再被ArcGIS这样的错误弄的一头雾水。
ArcGIS “Error HRESULT E_FAIL has been returned from a call to a COM component.” 异常的解决
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。