问题描述
我有相关的误差对标题的问题。进出口工作与C#和Visual Studio 2010。
I have a question related to the error on the title. Im working with c# and Visual Studio 2010.
我已经声明为形式的公共类FormularioGeneral:表,这是基础的形式在我的应用程序的其余部分。当我尝试访问设计视图我得到这个错误好几次,因为你可以在图片中看到:
I have a form declared as "public class FormularioGeneral : Form", which is the base for the rest of the forms in my application. When i try to access the Designer View i get this error several times, as you can see in the image:
InitializeComponent方法,其中的值赋给一个属性像这样的人在里面所有的错误引用行:
All the errors references lines inside the InitializeComponent method, where the value is assigned to a property like this one:
[...]
this.PanelMargenIzquierdoCapaBase.BackColor = m_ColorCapaBase;
[...]
但是,所有的变量都在同一类的只读属性,并宣称所有这些都是一个被称为在构造方法中指定。
But all the variables are declared in the same class as read-only properties and all of them are assigned inside a method which is called in the constructor.
属性声明:
protected Color m_VariableName;
public Color VariableName
{
get { return m_VariableName; }
set { }
}
构造函数code:
Constructor code:
public FormularioGeneral()
{
ConfigurarUI();
AccionesConstructor();
InitializeComponent();
PostInicializacionComponentes();
EstablecerIcono();
InicializarLocalizacionFormulario();
}
ConfigurarUI方式:
ConfigurarUI method:
public virtual void ConfigurarUI()
{
[...]
m_AltoBordeSuperiorCapaBase = 30;
m_AltoBordeInferiorCapaBase = 7;
m_AnchoBordesLateralesCapaBase = 7;
m_ColorCapaBase = Color.FromArgb(50, 100, 150);
m_ColorTextoCapaBase = Color.White;
m_ColorTextoBotonAplicacion = Color.Black;
m_FuenteTextoIzquierdoCapaBase = new System.Drawing.Font("Verdana", 11.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
m_FuenteTextoCentroCapaBase = new System.Drawing.Font("Verdana", 14.0F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
[...]
}
所以,据我所知,所有这些都使错误的变量是正确声明并赋值的InitilizeComponent函数被调用之前。
So, as far as i know, all the variable which are giving the errors are correctly declared and have a value assigned before the InitilizeComponent function is called.
林停留在这一点上不知道该怎么做才能解决这个问题。希望你们中的一些可以帮助我解决这个问题:D
Im stuck at this point and dont know what to do to solve the problem. Hope some of you can help me with this issue :D
感谢大家!牛逼
推荐答案
所以,我想同样的问题,修复我所做的:
So, I'd the same problem, for fix I did:
- 解决方案 - >明确的解决方案;
- 建设 - >重建解决方案;
- 在关闭Visual Studio中,重新打开。
非常感谢给Marshall贝尔柳!
这篇关于变量“变量名”或者是未声明或从未分配。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!