我正在Form.Designer.cs中设置下拉列表的默认值,但是当我在设计窗口中更改此对象或什至另一个对象的位置时,此行消失,并且下拉列表不显示任何值。
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.Enabled = true;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Items.AddRange(new object[] {
"beam center",
"force application"});
this.comboBox2.Location = new System.Drawing.Point(402, 258);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(121, 21);
this.comboBox2.TabIndex = 45;
this.comboBox2.SelectedIndex = 0;
您知道我该如何解决吗?预先感谢。
将其从设计器生成的代码中移出并移至Form_Load之类的位置