GroupBox可见性 [英] GroupBox Visibility

查看:93
本文介绍了GroupBox可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用一个非常简单的指令来控制groupbox的可见性。

I'm controlling groupbox visibility with a very simple instruction.

我有五个,当我选中一个复选框时,所选的组框应显示,而其他组则消失。

I have five, when I check a checkbox the selected groupbox should show while the others disappear.

一个工作(Oretronic)

one works (Oretronic)

        private void chk_Oretronic_Click(object sender, EventArgs e)
        {
            if (chk_Oretronic.Checked == true)
            {
                groupBox_10_20.Visible = false;
                groupBox_Idea_Scale.Visible = false;
                groupBox_10_17.Visible = false;
                groupBox_10_14.Visible = false;
                groupBox_Oretronic.Visible = true;
            }
            else
            {
                groupBox_Oretronic.Visible = false;
            }
        }

虽然其他四个不相同,但结果不同。

While the other four do not, same instruction but different results.

当我调试.Visible = true永远等于。

When I debug the .Visible = true never equates.

        private void chk_10_17_Scale_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_10_17_Scale.Checked == true)
            {
                groupBox_10_20.Visible = false;
                groupBox_Idea_Scale.Visible = false;
                groupBox_Oretronic.Visible = false;
                groupBox_10_14.Visible = false;
                groupBox_10_17.Visible = true;
            }
            else
            {
                groupBox_10_17.Visible = false;
            }
        }

        private void chk_Idea_Scale_CheckStateChanged(object sender, EventArgs e)
        {
            if (chk_Idea_Scale.Checked == true)
            {
                groupBox_Oretronic.Visible = false;
                groupBox_10_20.Visible = false;
                groupBox_10_17.Visible = false;
                groupBox_10_14.Visible = false;
                groupBox_Idea_Scale.Visible = true;
            }
            else
            {
                groupBox_Idea_Scale.Visible = false;
            }
        }

        private void chk_10_14_Scale_CheckStateChanged(object sender, EventArgs e)
        {
            if (chk_10_14_Scale.Checked == true)
            {
                groupBox_10_20.Visible = false;
                groupBox_Idea_Scale.Visible = false;
                groupBox_Oretronic.Visible = false;
                groupBox_10_17.Visible = false;
                groupBox_10_14.Visible = true;
                }
            else
            {
                groupBox_10_14.Visible = false;
            }
        }

        private void chk_10_20_Scale_CheckedChanged(object sender, EventArgs e)
        {
            
            if (chk_10_20_Scale.Checked == true)
            {
                groupBox_Oretronic.Visible = false;
                groupBox_Idea_Scale.Visible = false;
                groupBox_10_17.Visible = false;
                groupBox_10_14.Visible = false;
                groupBox_10_20.Visible = true;
            }
            else
            {
                groupBox_10_20.Visible = false;
            }
        }

这完全没有意义。

一组指令如何在一个工作中起作用实例而不是另一个?

How can a set of instructions work in one instance and not another?

Tac

tac

推荐答案

我让它们相互重叠。

I have them overlapping each other.

当我把组合框放在一边,所以没有重叠,那么它就可以了。

When I placed the groupboxes of to the side so there's no overlapping then it works.

所以我想使用"SendToBack"和"SendToBack"。和"BringToFront"这没有帮助。

So I thought to use the "SendToBack" and "BringToFront" this didn't help.

当我调试groupbox_xxxx.Visible时,仍然在组框上显示为false,应该为真。

Still when I debug the groupbox_xxxx.Visible shows false on the groupbox that should be true.


这篇关于GroupBox可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆