admin管理员组文章数量:1568557
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));
版权声明:本文标题:制作一个WinForm的闪屏 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1719366783a774145.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论