api 直接调用就是了[System.Runtime.InteropServices.DllImport("user32")] private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags); private const int AW_HOR_POSITIVE = 0x0001;//从左向右显示 private const int AW_BLEND = 0x80000;//透明渐变显示效果 AnimateWindow(this.Handle,1000,AW_HOR_POSITIVE);
看看WinForm Splash
[System.Runtime.InteropServices.DllImport("user32")]
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
private const int AW_HOR_POSITIVE = 0x0001;//从左向右显示
private const int AW_BLEND = 0x80000;//透明渐变显示效果
/// <summary>
/// 显示
/// </summary>
/// <param name="sender">窗口本身</param>
/// <param name="e">窗口参数</param>
void frmLogo_Shown(object sender, EventArgs e)
{
Thread.Sleep(50);
Bitmap MyBitmap = (Bitmap)this.PbLogo.Image.Clone();
int dh = MyBitmap.Height / 20;
int dw = MyBitmap.Width;
Graphics g = PbBYLogo.CreateGraphics();
Point[] MyPoint = new Point[20];
for (int y = 0; y < 20; y++)
{
MyPoint[y].X = 0;
MyPoint[y].Y = y * dh;
}
Bitmap bitmap = new Bitmap(MyBitmap.Width, MyBitmap.Height);
for (int i = 0; i < dh; i++)
{
for (int j = 0; j < 20; j++)
{
for (int k = 0; k < dw; k++)
{
bitmap.SetPixel(MyPoint[j].X + k, MyPoint[j].Y + i, MyBitmap.GetPixel(MyPoint[j].X + k, MyPoint[j].Y + i));
}
}
PbBYLogo.Image = bitmap;
PbBYLogo.Visible = true;
PbBYLogo.Update();
Thread.Sleep(50);
}
Close();
}
#endregion
(Thread.Sleep(50); Bitmap MyBitmap = (Bitmap)
this.PbLogo.Image.Clone();
Graphics g = PbBYLogo.CreateGraphics();
PbBYLogo.Image = bitmap;
PbBYLogo.Visible = true;
PbBYLogo.Update();
Thread.Sleep(50);)
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
private const int AW_HOR_POSITIVE = 0x0001;//从左向右显示
private const int AW_BLEND = 0x80000;//透明渐变显示效果
AnimateWindow(this.Handle,1000,AW_HOR_POSITIVE);