admin管理员组

文章数量:1530845

2024年6月26日发(作者:)

制作一个WinForm的闪屏.txt*一篇一篇的翻着以前的的签名,那时候的签名有多幼稚就有多

么的幼稚。你连让我报复的资格都没有-〞好想某天来电显示是你的号码。好想某天你的状态

是为我而写。 有些人,我们明知道是爱的,也要去放弃,因为没结局制作一个WinForm的

闪屏收藏 收藏

显示一个WinForms闪屏(Splash Screen)我的应用程序需要一定的时间来启动。我想在应用

程序继续加载时显示一个闪屏(就像Visual Studio .NET和Office应用程序那样)。工具箱

中没有这样的控件。我该如何实现呢? A:本专栏所附带的代码中包含了一个 SplashScreen

类:

view plaincopy to clipboardprint?

public class SplashScreen

{

public SplashScreen(Bitmap splash);

public void Close();

}

public class SplashScreen

{

public SplashScreen(Bitmap splash);

public void Close();

}

SplashScreen的构造器可以将显示的位图作为参数。Close方法用来关闭闪屏。通常情况下,

我们在处理窗体(form)的Load事件的方法中运用SplashScreen(在图1中可以看到形成

的闪屏):

view plaincopy to clipboardprint?

private void OnLoad(object

sender,EventArgs e)

{

Bitmap splashImage;

splashImage = new

Bitmap("");

SplashScreen splashScreen;

splashScreen = new

SplashScreen(splashImage);

//Do some lengthy operations, then:

();

Activate();

}

private void OnLoad(object

sender,EventArgs e)

{

Bitmap splashImage;

splashImage = new

Bitmap("");

SplashScreen splashScreen;

splashScreen = new

SplashScreen(splashImage);

//Do some lengthy operations, then:

();

Activate();

}

在关闭闪屏后,你必须激活窗体,将它放到最显著的位置。

你可以将任何位图作为一个闪屏。你也可以通过构建一个新的位图对象从BMP或JPG文件创

建位图:

view plaincopy to clipboardprint?

Bitmap splashImage;

splashImage = new Bitmap("");

Bitmap splashImage;

splashImage = new Bitmap("");

或者你也可以用从窗体资源加载的一个图片:

view plaincopy to clipboardprint?

using ces;

ResourceManager resources;

resources = new

ResourceManager(typeof(MyForm));

Bitmap splashImage;

SplashImage =

(Bitmap)(ect(

"SplashImage"))

using ces;

ResourceManager resources;

resources = new

ResourceManager(typeof(MyForm));

本文标签: 闪屏显示加载方法没有