我必须在UI上修复一些东西
应用程序运行正常 但是当我改变groupboxsize的大小时,它会给我一个错误。
这是一个代码
public class NumericalTextBox : TextBox
{
private int MaxValue;
public NumericalTextBox(int max_value = -1)
{
MaxValue = max_value;
}
protected override void OnKeyDown(KeyEventArgs e)
{
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
}
}
partial class TestClass
{
// some code
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtHeureMinutes = new MyComp.Common.Controls.NumericalTextBox(60);
this.txtHeureHeure = new MyComp.Common.Controls.NumericalTextBox(24);
this.splitContainer1.Panel2.Controls.Add(this.groupBox1);
this.groupBox1.Controls.Add(this.txtHeureMinutes);
this.groupBox1.Controls.Add(this.txtHeureHeure);
this.groupBox1.Size = new System.Drawing.Size(270, 270);
}
// declaration
private MyComp.Common.Controls.NumericalTextBox txtHeureMinutes;
private MyComp.Common.Controls.NumericalTextBox txtHeureHeure;
}
答案 0 :(得分:1)
您可能需要检查designer.cs
文件以确认文本框确实存在于表单控件集合中。