1

首先,我希望标签、链接和其他按钮在第一次单击 question_group2 时消失并移动。但在此之后,我希望在再次单击相同按钮后重置项目。这是我的代码。起初它可以满足我的要求,但我无法弄清楚如何在第二次单击时重置。我还必须继续工作,所以第三次点击会消失一切,第四次会再次重置一切。请帮忙。谢谢

    private bool button2Clicked = false;        

    private void question_group2_Click(object sender, EventArgs e)
    {
        button2Clicked = true;
        if (button2Clicked == true)
        {
            this.question_group3_button.Location = new System.Drawing.Point(169, 284);
            this.question1_label.Visible = false;
            this.question2_label.Visible = false;
            this.question3_label.Visible = false;
            this.question4_label.Visible = false;

            this.question1_link.Visible = false;
            this.question2_link.Visible = false;
            this.question3_link.Visible = false;
            this.question4_link.Visible = false;

            this.add_question_link.Visible = false;
        }
4

1 回答 1

3

this.question1_label.Visible = !this.question1_label.Visible
每次点击都会将可见性设置为相反的值

于 2013-11-04T21:45:04.900 回答