This article will show you how you can create a blinking text
in windows application using C#.net. in this article I have start text blinking
on button click.
Some of my previous articles are as follows: Error
Handling in Windows Application Using C#.Net, Confirmation
Message on Button Click and Capture YES/NO Click by User in Windows
application, C#, Dynamically
Add Textbox Control in Panel and Clear All on Single Click Using C#.Net in
Windows Application, Dynamically
Change Form Background Color C#.Net in Windows Application.
In this article first we will create a new windows application
and add button label and a timer control.
Timer control.
Now set the timer control interval to fire.
Now add the below code.
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void button1_Click(object
sender, EventArgs e)
{
}
int
maxNumberOfBlinksCount = 10;
int
totalBlinkCount = 0;
private
void button1_Click_1(object
sender, EventArgs e)
{
timer1.Enabled = true;
}
private
void timer1_Tick(object
sender, EventArgs e)
{
label1.Visible = true;
totalBlinkCount++;
if
(totalBlinkCount == maxNumberOfBlinksCount)
{
timer1.Stop();
label1.Visible = false;
totalBlinkCount = 0;
}
}
}
}
|
In above I have enabled the timer control on button click
and now in I have generated the code to blink the text. In above code I have
assign the max blink count of the text. After reaching the max no of blink
count text blink will stop.
Now we have done run the application and check the output.
0 comments:
Please let me know your view