[转]有关WorldWind1.4的worldwind.cs窗口设计器打开错误的解决方法
Solution for Designer error when opening WorldWind.cs in WW1.4.0
When I load the WW project in my Visual C# 2005 Express Edition , I get the following error when I open WorldWind.cs. I can open the code but the designer refuses to open it.
The designer cannot process the code at line 1070: this.splitContainer.Panel1Collapsed = !World.Settings.BrowserVisible; The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again. at Microsoft.VisualStudio.Design.Serializat ion.CodeDom.XML.CodeDomXmlProcessor.Crea teQuoteexpression_r(XmlElementData xmlElement) at Microsoft.VisualStudio.Design.Serializat ion.CodeDom.XML.CodeDomXmlProcessor.XmlE lementData.get_CodeDomElement() at Microsoft.VisualStudio.Design.Serializat ion.CodeDom.XML.CodeDomXmlProcessor.EndE lement(String prefix, String name, String urn) at Microsoft.VisualStudio.Design.Serializat ion.CodeDom.XML.CodeDomXmlProcessor.Pars e(XmlReader reader) at Microsoft.VisualStudio.Design.Serializat ion.CodeDom.XML.CodeDomXmlProcessor.Pars eXml(String xmlStream, CodeStatementCollection statementCollection, String fileName, String methodName) at Microsoft.VisualStudio.Design.Serializat ion.CodeDom.VSCodeDomParser.OnMethodPopu lateStatements(Object sender, EventArgs e) at System.CodeDom.CodeMemberMethod.get_Stat ements() at System.ComponentModel.Design.Serializati on.TypeCodeDomSerializer.Deserialize(IDe signerSerializationManager manager, CodeTypeDeclaration declaration) at System.ComponentModel.Design.Serializati on.CodeDomDesignerLoader.PerformLoad(IDe signerSerializationManager manager) at Microsoft.VisualStudio.Design.Serializat ion.CodeDom.VSCodeDomDesignerLoader.Perf ormLoad(IDesignerSerializationManager serializationManager) at Microsoft.VisualStudio.Design.Serializat ion.CodeDom.VSCodeDomDesignerLoader.Defe rredLoadHandler.Microsoft.VisualStudio.T extManager.Interop.IVsTextBufferDataEven ts.OnLoadCompleted(Int32 fReload)
Is this a limitation of C# 2005 Express Edition and should I try VS 2005 or an equivalant. Any suggestions ?
Solution:在WorldWind.cs 文件中加一个函数InitializeWorldWindows();函数体主要由InitializeComponent()中去掉的语句组成,实现加载WorldWindows窗口并显示地球的功能,InitializeWorldWindows()加在构造函数MainApplication()中的InitializeComponent()函数的调用之后;InitializeWorldWindows函数如下:
private void InitializeWorldWindows() { // // splitContainer // this.splitContainer.Orientation = getWebBrowserOrientationFromSetting(World.Settings.BrowserOrientationHorizontal); this.splitContainer.Panel1Collapsed = !World.Settings.BrowserVisible; // // worldWindow // this.worldWindow = new WorldWind.WorldWindow(); this.worldWindow.AllowDrop = true; this.worldWindow.Cache = null; this.worldWindow.Caption = ""; this.worldWindow.CurrentWorld = null; this.worldWindow.Dock = System.Windows.Forms.DockStyle.Fill; this.worldwindows.isRenderDisabled = false; this.worldWindow.Location = new System.Drawing.Point(0, 0); this.worldWindow.Name = "worldWindow"; this.worldWindow.ShowLayerManager = false; this.worldWindow.Size = new System.Drawing.Size(splitContainer.Panel2.Width, splitContainer.Panel2.Height); this.worldWindow.TabIndex = 0; this.worldWindow.Text = "worldWindow"; // // splitContainer1.Panel1 // this.splitContainer.Panel1.Controls.Add(this.webBrowserPanel); this.splitContainer.Panel1.Name = "webBrowserPanel"; // // splitContainer1.Panel2 // this.splitContainer.Panel2.Controls.Add(this.worldWindow); this.splitContainer.TabIndex = 0; }
在worldwind.cs的InitializeComponent()函数中注释掉下面的代码,使用Ctrl+F进行查找然后注释。
this.worldWindow = new WorldWind.WorldWindow(); this.toolBarButtonLatLonLines = new System.Windows.Forms.ToolBarButton(); this.splitContainer.Orientation = getWebBrowserOrientationFromSetting(World.Settings.BrowserOrientationHorizontal); this.splitContainer.Panel1Collapsed = !World.Settings.BrowserVisible; // // worldWindow // this.worldWindow.AllowDrop = true; this.worldWindow.Cache = null; this.worldWindow.Caption = ""; this.worldWindow.CurrentWorld = null; this.worldWindow.Dock = System.Windows.Forms.DockStyle.Fill; this.worldwindows.isRenderDisabled = false; this.worldWindow.Location = new System.Drawing.Point(0, 0); this.worldWindow.Name = "worldWindow"; this.worldWindow.ShowLayerManager = false; this.worldWindow.Size = new System.Drawing.Size(splitContainer.Panel2.Width, splitContainer.Panel2.Height); this.worldWindow.TabIndex = 0; this.worldWindow.Text = "worldWindow"; // // splitContainer1.Panel2 // this.splitContainer.Panel2.Controls.Add(this.worldWindow);
原文链接:Solution for Designer error when opening WorldWind.cs in WW1.4.0
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
2015-03-15 GeoServer+MySQL安装及配置过程
2015-03-15 GeoServer 常见问题总结