📄 splashscreen.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
namespace LiveExpoApp
{
public partial class SplashScreen : Form
{
private AutoResetEvent mainAppInitialized;
private System.Windows.Forms.Timer progressBarTimer;
public SplashScreen(AutoResetEvent appInitialized, int minimumDisplayTime)
{
InitializeComponent();
mainAppInitialized = appInitialized;
progressBar1.Maximum = minimumDisplayTime;
}
private void SplashScreen_Activated(object sender, EventArgs e)
{
SHFullScreen(this.Handle, SHFS.HIDESIPBUTTON | SHFS.HIDESTARTICON | SHFS.HIDETASKBAR);
progressBarTimer = new System.Windows.Forms.Timer();
progressBarTimer.Interval = 1000;
progressBarTimer.Tick += new EventHandler(progressBarTimer_Tick);
progressBarTimer.Enabled = true;
}
void progressBarTimer_Tick(object sender, EventArgs e)
{
if (progressBar1.Value < progressBar1.Maximum)
progressBar1.Value += 1;
else
{
progressBarTimer.Enabled = false;
progressBarTimer.Dispose();
// We have been waiting for the minimum amount of time. Now let's see if the application is initialized so we can continue to run.
mainAppInitialized.WaitOne();
this.Close();
}
}
[DllImport("aygshell.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool SHFullScreen(IntPtr hwndRequester,
SHFS dwState);
[Flags()]
internal enum SHFS
{
SHOWTASKBAR = 0x0001,
HIDETASKBAR = 0x0002,
SHOWSIPBUTTON = 0x0004,
HIDESIPBUTTON = 0x0008,
SHOWSTARTICON = 0x0010,
HIDESTARTICON = 0x0020,
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -