?? splasher.cs
字號:
using System;
using System.Threading;
using System.Windows.Forms;
namespace MKIms3
{
public class Splasher
{
static SplashForm MySplashForm = null;
static Thread MySplashThread = null;
static void ShowThread()
{
MySplashForm = new SplashForm();
Application.Run(MySplashForm);
}
/// <summary>
/// 開啟一個新的線程來現實splshform
/// </summary>
static public void Show()
{
if (MySplashThread != null)
return;
MySplashThread = new Thread(new ThreadStart(Splasher.ShowThread));
MySplashThread.IsBackground = true;
MySplashThread.ApartmentState = ApartmentState.MTA;
MySplashThread.Start();
}
/// <summary>
/// 提供關閉splshform窗體的接口
/// </summary>
static public void Close()
{
if (MySplashThread == null) return;
if (MySplashForm == null) return;
try
{
MySplashForm.Invoke(new MethodInvoker(MySplashForm.Close));
}
catch (Exception)
{
}
MySplashThread = null;
MySplashForm = null;
}
/// <summary>
/// 設置提示信息
/// </summary>
static public string Status
{
set
{
if (MySplashForm == null)
{
return;
}
MySplashForm.StatusInfo = value;
}
get
{
if (MySplashForm == null)
{
throw new InvalidOperationException("Splash Form 沒有啟動");
}
return MySplashForm.StatusInfo;
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -