1
我有两个组合框comboBox1
& comboBox2
。我会改变一些属性comboBox1
& comboBox2
取决于comboBox1
的SelectedItem
。我在Form1_Load
块中写下了以下代码:根据另一个组合框操纵combBox属性
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
if(this->comboBox1->SelectedItem=="Letters"){
this->comboBox1->Size=System::Drawing::Size(238,27);
this->comboBox1->Location=System::Drawing::Point(301,73);
this->comboBox2->Visible= true;
}
else{
this->comboBox1->Size=System::Drawing::Size(473,27);
this->comboBox2->Visible= false;
}
}
但它不起作用!
你确定代码进入Form1_Load吗? – r3st0r3
它在Form1_Load中,可以在我的问题中看到。 – Aan
我的意思是,代码应该在Form1_Load事件中?我认为它应该在comboBox1的SelectedIndexChanged事件下。 – r3st0r3