Add windows form.
add two timer control in that form
set form background as white
do the complition with help of following code
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
namespace gridcomputing
{
public partial class frmSplashScreen : Form
{
#region "VARIABLES"
protected int intCurrentGradientShift = 10;
protected int intGradiantStep = 5;
#endregion
#region "CONSTRUCTOR"
public frmSplashScreen()
{
InitializeComponent();
}
#endregion
#region "FORM LOAD"
private void frmSplashScreen_Load(object sender, EventArgs e)
{
}
#endregion
#region "TIMER TICK"
private void tmrAnimation_Tick(object sender, EventArgs e)
{
// Obtain the Graphics object exposed by the Form.
Graphics grfx = CreateGraphics();
// Set the font type, text, and determine its size.
Font font = new Font("TIMES NEW ROMAN", 40,
FontStyle.Regular , GraphicsUnit.Point);
string strText = " Quality of Service \n" +
" in \n" +
" Grid Computing \n";
SizeF sizfText = new SizeF(grfx.MeasureString(strText, font));
// Set the point at which the text will be drawn: centered
// in the client area.
PointF ptfTextStart = new PointF(Convert.ToSingle(ClientSize.Width - sizfText.Width) / 2,
Convert.ToSingle(ClientSize.Height - sizfText.Height) / 2);
// Set the gradient start and end point, the latter being adjusted
// by a changing value to give the animation affect.
PointF ptfGradientStart = new PointF(0, 0);
PointF ptfGradientEnd = new PointF(intCurrentGradientShift, 200);
// Instantiate the brush used for drawing the text.
LinearGradientBrush grBrush = new LinearGradientBrush(ptfGradientStart,
ptfGradientEnd, Color.Maroon, BackColor);
// Draw the text centered on the client area.
grfx.DrawString(strText, font, grBrush, ptfTextStart);
grfx.Dispose();
// Shift the gradient, reversing it when it gets to a certain value.
intCurrentGradientShift += intGradiantStep;
if (intCurrentGradientShift == 500)
{
intGradiantStep = -5;
}
else if (intCurrentGradientShift == -50)
{
intGradiantStep = 5;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Close();
}
#endregion
}
}
Saturday, March 13, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment