根据另一个组合框属性操作组合框
我有两个组合框 comboBox1
&组合框2。我会更改 comboBox1
& 的一些属性comboBox2
取决于 comboBox1
的 SelectedItem
。我在 Form1_Load
块中编写了以下代码:
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;
}
}
但它不起作用!
I have two comboBoxes comboBox1
& comboBox2
. I would change some properties of comboBox1
& comboBox2
depending on the SelectedItem
of comboBox1
. I wrote the following code in Form1_Load
block:
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;
}
}
But it doesn't work!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该代码应该位于 Form1_Load 事件内吗?我认为它应该在comboBox1的SelectedIndexChanged事件下。
Is that code supposed to be inside the Form1_Load event? I think it should be under the comboBox1's SelectedIndexChanged event.