给出一个实例,演示一下。

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace FromTest
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void buttonShowHid_Click(object sender, EventArgs e)
            {
                switch (labeltest.Visible)
                {
                    case true:
                        {
                            labeltest.Visible = false;
                            break;
                        }
                    case false:
                        {
                            labeltest.Visible = true;
                            break;
                        }
                }
            }
        }
    }