简体   繁体   English

如何在不设置定时器等的情况下在Windows窗体应用程序中构建启动画面?

[英]How do I build a splash screen into a Windows Forms application without setting timers etc?

我希望在我的应用程序的主窗体加载时显示启动画面,并且启动窗体应该消失,而不必在构建定时器等等。另一个重要的事情是主窗体应该是确定何时应用程序退出,何时使用我的启动窗体启动应用程序然后用它来打开我的主窗体我无法处理启动画面,因为这会杀死应用程序。

using Microsoft.VisualBasic.ApplicationServices;

public class Startup : WindowsFormsApplicationBase
{
    protected override void OnCreateSplashScreen()
    {
        SplashScreen = new SplashForm();
    }

    protected override void OnCreateMainForm()
    {
        MainForm = new MyMainForm();
    }
}

static class Program
{
    static void Main(string[] args)
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        new Startup().Run(args);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 windows 窗体应用程序中构建启动画面? - How to build splash screen in windows forms application? 如何在Windows应用程序的初始屏幕中制作进度指示器的动画 - How can I animate a progress indicator in a splash screen of a windows application 如何发布Windows窗体应用程序? - How do I publish a Windows Forms Application? 如何在Windows窗体应用程序中显示图像而又不知道需要显示的图像数量? - How do I display images in a Windows Forms Application without knowing the number of images that need to be displayed? 如何在没有可见窗口的情况下启动.net Windows窗体应用程序? - How do I launch .net windows forms application with no visible windows? 如何设置在VS2010中启动Windows窗体应用程序时加载的窗体? (将启动对象设置为无效) - How do I set the form that loads on startup of my Windows Forms application in VS2010? (Setting startup object to no avail) Windows窗体计时器 - Windows Forms Timers 我应该在 xamarin forms 中创建启动画面吗? - should i create splash screen in xamarin forms? Windows窗体应用程序-启动屏幕标签未更新 - Windows Form Application - Splash screen label not updating 如何从Windows窗体应用程序以编程方式浏览网站? - How do I navigate a website programmatically from a windows forms application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM