Example1 :- Blinking text
Add a new Form i.e.,FormBText to the Windows
Application WABasics
Create one label & timer[Timer Will Appear in
Component Tray ] & set the following properties to them
Label1:-
Name
: lblDisplay
AutoSize
: True
BackColor : Window
Frame
Timer1:-
Name : timer1
Enabled : True
Interval : 1000
Design :-
Generate the EventHandler for Timer Tick Event
& write the following code in Source[FormBText.cs]
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 WABasics
{
public partial class FormBText : Form
{
int i
= 0;
public
FormBText()
{
InitializeComponent();
}
private
void timer1_Tick(object
sender, EventArgs e)
{
if
(i == 0)
{
lblDisplay.Text = "Sampath Kumar";
lblDisplay.ForeColor = Color.Pink;
lblDisplay.BackColor = Color.Green;
i = 1;
}
else
{
lblDisplay.Text = "Karimnagar";
lblDisplay.ForeColor = Color.GreenYellow;
lblDisplay.BackColor = Color.Indigo;
i = 0;
}
}
}
}
|
Result :-
Example2 [FormScrollingMarqueeText]:-
Add a new Form i.e., FormScrollingMarqueeT
to the Windows Application WABasics
Create one label & timer[Timer Will Appear in
Component Tray ] & set the following properties to them
label1:-
Name
: lblDisplay
AutoSize
: True
BackColor : Dark
Violet
timer1:-
Name : timer1
Enabled : True
Interval : 99
Design :-
Generate the EventHandler for Timer tick Event
& write the following code in Source[FormScrollingMarqueeT]
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 WABasics
{
public partial class FormScrollingMarqueeT:Form
{
public
FormScrollingMarqueeT()
{
InitializeComponent();
}
private
void timer1_Tick(object
sender, EventArgs e)
{
lblSample.Left = lblSample.Left -
20;
if
(lblSample.Left +lblSample.Width <= 0)
lblSample.Left = this.Width;
}
}
}
|
Result :-
No comments:
Post a Comment