網頁

2011年10月3日 星期一

[C#] label 不停的閃爍

C#如何使label不停的閃爍

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 File
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = "我閃";

            label1.Tag = 1;
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (label1.Tag.ToString() == "1")
            {
                label1.Visible = false;
                label1.Tag = 0;
            }
            else
            {
                label1.Visible = true;
                label1.Tag = 1;
            }
        }
    }
}

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。