110,535
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
{
public class Form1 : Form
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// show the splash
SplashForm form = new SplashForm();
form.Show();
// give a chance to the splash to draw itself.
Application.DoEvents();
// time consuming tasks...
for (int i = 0; i < 50; i++)
{
Thread.Sleep(100);
}
// close the splash
form.Close();
}
[STAThread]
static void Main()
{
if (MessageBox.Show("Click OK to login") == DialogResult.OK)
{
Application.Run(new Form1());
}
}
}
public class SplashForm : Form
{
public SplashForm()
{
this.StartPosition = FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.None;
this.ShowInTaskbar = false;
this.Size = new Size(200, 200);
}
protected override void OnPaint(PaintEventArgs e)
{
using(Font biggerFont = new Font(FontFamily.GenericSansSerif, 20))
{
e.Graphics.DrawString("Hello Splash", biggerFont, Brushes.Azure, new PointF(20, 80));
}
}
}
}
http://blog.csdn.net/kenkao/archive/2009/02/25/3937056.aspx你要的