zoukankan      html  css  js  c++  java
  • WPF启动屏幕SplashScreen

    SplashScreen类为WPF应用程序提供启动屏幕。

    方法一:设置图片属性

    1. 添加启动图片到项目中

    2. 设置图片属性的Build Action为SplashScreen

       

    方法二:编写代码

    1. 在App.xaml.cs中重写OnStartUp方法:

     1 using System;
     2 using System.Windows;
     3 
     4 namespace StaticLanguageSelect
     5 {
     6     /// <summary>
     7     /// Interaction logic for App.xaml
     8     /// </summary>
     9     public partial class App : Application
    10     {
    11         protected override void OnStartup(StartupEventArgs e)
    12         {
    13             //根据图片路径,实例化启动图片
    14             SplashScreen splashScreen = new SplashScreen("\3-2.png");
    15             splashScreen.Show(false);
    16 
    17             //上面Show()方法中设置为true时,程序启动完成后启动图片就会自动关闭,
    18             //设置为false时,启动图片不会自动关闭,需要使用下面一句设置显示时间,例如5s
    19             splashScreen.Close(new TimeSpan(0,0,5));
    20 
    21             base.OnStartup(e);
    22         }
    23     }
    24 }
    
    
    
  • 相关阅读:
    自动刷新页面
    docker 数据卷管理
    docker container(容器)
    docker images
    docker 设计原理
    hbase数据原理及基本架构
    详谈kafka的深入浅出
    django介绍及路由系统
    mysql爱之深探测
    mysql数据库内容相关操作
  • 原文地址:https://www.cnblogs.com/zwh1993/p/SplashScreen.html
Copyright © 2011-2022 走看看