GROUPBOX 中有 2 个面板?窗体

发布于 2024-12-03 05:34:32 字数 428 浏览 1 评论 0原文

是否可以将 2 个面板放入一个组盒中?

因为我在组框中放置了 2 个面板,并将它们隐藏起来。

每当我尝试使它们可见时,只会出现第一个面板。

我在没有进入组框的情况下尝试过,效果很好。

我的代码有问题吗??

if (comboBox3.SelectedIndex == 1)
        {
            panel4.Visible = false;
            panel9.Visible = true;

        }

        if (comboBox3.SelectedIndex == 2)
        {
            panel9.Visible = false;
            panel4.Visible = true;

        }

Is it possible to put 2 panels inside a groupbox??

Because I put 2 panels inside my groupbox and I Made them hidden.

Whenever I try to make them Visible only the first panel appears.

I've tried it without being inside the groupbox and it worked fine.

Is there wrong with my code??

if (comboBox3.SelectedIndex == 1)
        {
            panel4.Visible = false;
            panel9.Visible = true;

        }

        if (comboBox3.SelectedIndex == 2)
        {
            panel9.Visible = false;
            panel4.Visible = true;

        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

¢蛋碎的人ぎ生 2024-12-10 05:34:32

是的,你可以这样做。

但是您的代码不正确并执行相同的视图..当您选择组合框时,它只显示一个面板。
如果您想在组框中显示两个面板。启用它们。
像这样的:

    if (comboBox3.SelectedIndex == 1)
    {
        panel4.Visible = true; // Display Two Panels on your group box
        panel9.Visible = true;

    }

    if (comboBox3.SelectedIndex == 2)
    {
        panel9.Visible = false;   //Display only 1 Panel
        panel4.Visible = true;

    }

问候

Yes you can do that.

But your code is incorrect and execute same view..it only just show only one panel when your combobox was selected.
If you want to show both panels on your group box. Enable them both.
Something like this:

    if (comboBox3.SelectedIndex == 1)
    {
        panel4.Visible = true; // Display Two Panels on your group box
        panel9.Visible = true;

    }

    if (comboBox3.SelectedIndex == 2)
    {
        panel9.Visible = false;   //Display only 1 Panel
        panel4.Visible = true;

    }

Regards

深爱成瘾 2024-12-10 05:34:32

我知道我的回答可能看起来很奇怪。但我遇到了这个问题并且很容易解决了。我认为你复制了你的分组框或面板。从工具箱中取出一个新面板。至少这个看起来奇怪(而且毫无意义)的解决方案对我来说非常有效。

I know my answer may seems to weird. But i had this problem and solved it easily. I think you taken copies of your groupboxes or panels. Take a new panel from your toolbox. At least this weird (and non sense) looking solution worked great for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文