首页 > 其他分享 >Splash Screen

Splash Screen

时间:2022-10-24 21:13:01浏览次数:52  
标签:tmr form screen SplashScreen Splash cs new Screen

1. Create a new project in Visual Studio as in the following:

Create New Project

2. I created a simple Hello World application (MainForm.cs) that will be shown after the splash screen.

Hello world application
 
3. Add another form that will be used as the splash screen for this project as in the following:

Add another form

4. Change the Border style of the SplashSreen form to none.

Border style of SplashSreen form
 
 5. Change the start position to the center of the screen so the splash screen displays in the center of the screen.

start position
 
6. Add a PictureBox to the SplashScreen form using the toolbox. Actually I am using an image for the splash screen (you can try something different).

Add Picture box to SplashScreen form

 image for the splash screen
 
7. Go to the file program.cs that contains the Main() method and make sure that the program starts with the SplashScreen form.

Application.Run(new SplashScreen());

8. Go to the SplashScreen.cs for the form, click on "Events" and double-click on the "Shown" event as in the following:

SplashScreen.cs form, click on Events
 
9. Add this code:

//Use timer class

 Timer tmr;

 private void SplashScreen_Shown(object sender, EventArgs e)

 {

      tmr = new Timer();

     //set time interval 3 sec

     tmr.Interval = 3000;

     //starts the timer

     tmr.Start();

     tmr.Tick += tmr_Tick;

 }

 void tmr_Tick(object sender, EventArgs e)

 {

     //after 3 sec stop the timer

     tmr.Stop();

     //display mainform

     Mainform mf = new Mainform();

     mf.Show();

     //hide this form

     this.Hide();

 }

10. Go to the Events for the MainForm.cs form.

MainForm Events

 Double-click on the FormClosed Event and add this Code:

private void Mainform_FormClosed(object sender, FormClosedEventArgs e)

{

     //exit application when form is closed

     Application.Exit();

Final Preview

Final Preview 

标签:tmr,form,screen,SplashScreen,Splash,cs,new,Screen
From: https://www.cnblogs.com/adamgq/p/16823002.html

相关文章

  • serialportscreen-2022-10-24
    1、当数据变量存在2位整数+1位小数、2整+0小、3整+1小、1整+0小、3整+0小混杂在一起显示时,并且显示格式都选择为了居中,会发现显示效果参差不齐,一开始以为是控件的位置在鼠......
  • 【科研利器】Screen命令让程序永不掉线
    大家好哇!不知道大家有没有遇到过这样一个问题,正在服务器上跑code,但是由于突然断网了或者是长时间无操作等原因导致服务器自动退出登录,即账号已经closeconnect了,那自然程序......
  • In Ubuntu 20.04 capture screen/screenshot via Fn+Prtsc short cut combination.
               ......
  • 9scrapy_splash组件的使用
    scrapy_splash组件的使用学习目标了解scrapy_splash组件的作用了解scrapy_splash组件的使用1.什么是scrapy_splash?scrapy_splash是scrapy的一个组件scrapy-sp......
  • 群晖后台安装 ipkg 包管理 和 screen
    wgethttp://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/syno-i686-bootstrap_1.2-7_i686.xshchmod+xsyno-i686-bootstrap_1.2-7_i686.xshshsyno......
  • 已整理-Linux_nohup&screen命令
    目录:1、nohup命令2、screen命令 1、nohup命令作用:1)、nohup英文全称nohangup(不挂起),用于在系统后台不挂断地运行命令,退出终端不会影响程序的运行。......
  • mac必备工具:ScreenFlow 10 轻松录制屏幕好帮手
    mac上有什么必备的工具值得推荐?若说录制屏幕,首选ScreenFlow10,这款App能让你轻松录制屏幕、处理摄像头拍摄的视频,并为它们添加旁白音频。ScreenFlow10轻松录制屏幕好......
  • Python爬虫之scrapy_splash组件的使用
    scrapy_splash组件的使用学习目标了解scrapy_splash组件的作用了解scrapy_splash组件的使用1.什么是scrapy_splash?scrapy_splash是scrapy的一个组件scrapy-splash加载js......
  • screen的一些常用命令和快捷键
    screen的一些常用命令和快捷键命令screen-Sscreen_name,新建screen,并指定名字screen-dscreen_name,detach正在使用的screenscreen-Rscreen_name,连接指定screen......
  • serialportscreen-2022-10-10
    1、在DGUSV5.08上一次性载入多张新增的背景图,由于是选择同时上传,出现了有靠后序号的背景图传到软件上后排在了靠前的位置(譬如原来应该是82、83、84、85,但是变为82、85、83......