我伸出像這樣C#在設計擴展控制
public partial class NewControl : OriginalControl
{
public NewControl()
{
}
}
控制和改變的MyForm.Designer.cs這些線路從
到
private NewControl control1;
this.control1 = new NewControl();
如何過當我在設計師中打開我的表單時,出現此錯誤:
Failed to load designer. Check the source code for syntax errors and check if all references are available.
ICSharpCode.FormsDesigner.FormsDesignerLoadException: System.ComponentModel.Design.Serialization.CodeDomSerializerException: Could not find type 'NewControl'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU. at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression) at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement) at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject) at ICSharpCode.FormsDesigner.Services.ProjectResourcesComponentCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject) at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject) at ICSharpCode.FormsDesigner.Services.ProjectResourcesComponentCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject) at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)
System.ComponentModel.Design.Serialization.CodeDomSerializerException: The variable 'control1' is either undeclared or was never assigned. at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadDesigner()
at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadAndDisplayDesigner() at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadInternal(OpenedFile file, Stream stream) at ICSharpCode.SharpDevelop.Gui.AbstractViewContentHandlingLoadErrors.Load(OpenedFile file, Stream stream)
我該如何延長我的控制權?
你的意思是「公共分類NewControl:Fully.Qualified.OriginalControl」嗎?因爲不幸的是沒有任何效果。 – user1340531 2013-03-28 08:02:29
號我的意思是 private Fully.Qualified.OriginalControl control1; this.control1 = new Fully.Qualified.OriginalControl(); – dotNET 2013-03-28 08:04:42
這樣做了,謝謝! – user1340531 2013-03-28 08:13:52