使面板可见 C# Winforms - Visual Studio
我想要的是,每当我在组合框中选择某个索引时,某个面板就会变得可见。
这就是我所做的:
我创建了一个组合框 我创建了 2 个面板,
我已将属性选项卡中的 2 个面板的可见性设置为 FALSE,
但是当有人在我的 ComboBox 上选择某些内容时,我无法将它们设置为可见。
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox3.SelectedIndex == 0)
{
panel9.Visible();
}
}
注意:我已将 2 个面板停靠在同一个 GroupBox 中。
我的代码有什么问题T_T。它说非言语成员。 :((
编辑** 我有一个新问题。每次我选择另一个选项。已设置为可见的面板不会恢复隐藏。
当我选择索引 1 时它会出现,但当我选择索引2时它也会出现oO?
What I want is that whenever I choose a certain index in my ComboBox a certain panel will become visible.
So Here is What I've done:
I've created a ComboBox
I've created 2 Panels
I've set the visibility of the 2 Panels in their properties tab to FALSE
However I was not able to set them to visible when somebody selects something on my ComboBox.
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox3.SelectedIndex == 0)
{
panel9.Visible();
}
}
Note: I've docked the 2 Panels in the same GroupBox.
What's wrong with my code T_T. It says non vocable member. :((
EDIT** I have a new problem. Everytime I pick another option. The panel which has been set to visible won't get back to hidden.
It will appear when I choose Index 1 but when I choose Index 2 it will also appear o.O?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您将 () 放在其后面时,它表示不可调用成员,因为您正在调用可见(这是一个属性)作为方法。只需将该属性设置为如下值
panel9.Visible = true;
It says non invocable member as you are calling visible, which is a property, as a method when you place the () after it. Just set the property to a value as below
panel9.Visible = true;
它应该是
panel9.Visible = true;
在这种情况下只需执行以下操作
It should be
panel9.Visible = true;
In that case just do something like this