我想创建一个复选框,如果选中,那么它应该显示下拉菜单。如果未选中,则它应该隐藏下拉菜单。这就是我的代码在 Form.Designer.cs 文件中的样子。
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Items.AddRange(new object[] {
"Database 1",
"Database 2",
"Database 3"});
this.comboBox2.Location = new System.Drawing.Point(165, 436);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(150, 21);
this.comboBox2.TabIndex = 13;
this.comboBox2.Text = "Database";
我在其他文件中的复选框代码是
if (checkBox1.CheckState == CheckState.Checked)
{
}