国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

DevExpress之SplashScreen用法實例

2020-01-24 02:30:25
字體:
來源:轉載
供稿:網友

本文實例展示了DevExpress中SplashScreen的用法,對于C#初學者來說有一定的參考借鑒價值,具體用法如下:

關鍵代碼部分如下:

using DevExpress.XtraSplashScreen;using System;namespace DevExpressUtilHelpV3{  /// <summary>  /// 基于.NET 3.0的 SplashScreen工具類  /// </summary>  public static class SplashScreenToolV3  {    private const bool FadeIn = false;    private const bool FadeOut = true;    private const bool ThrowExceptionIfIsAlreadyShown = false;    private const bool ThrowExceptionIfIsAlreadyClosed = false;    /// <summary>    /// ShowSplashScreen    /// </summary>    /// <param name="type">WaitForm</param>    public static void ShowSplashScreen(Type type)    {      CloseSplashScreen();      SplashScreenManager.ShowForm(null, type, FadeIn, FadeOut, ThrowExceptionIfIsAlreadyShown);    }    /// <summary>    /// CloseSplashScreen    /// </summary>    public static void CloseSplashScreen()    {      if (SplashScreenManager.Default != null)      {        //Thread _task = new Thread(() =>        //{        SplashScreenManager.CloseForm(ThrowExceptionIfIsAlreadyClosed);        //});        //_task.Start();      }    }    /// <summary>    /// SetCaption    /// </summary>    /// <param name="caption">需要設置的Title</param>    public static void SetCaption(string caption)    {      if (SplashScreenManager.Default != null && !string.IsNullOrEmpty(caption))      {        SplashScreenManager.Default.SetWaitFormCaption(caption);      }    }    /// <summary>    /// SetDescription    /// </summary>    /// <param name="description">需要設置的文字提示信息</param>    public static void SetDescription(string description)    {      if (SplashScreenManager.Default != null && !string.IsNullOrEmpty(description))      {        SplashScreenManager.Default.SetWaitFormDescription(description);      }    }  }}

測試代碼如下:

try{ SplashScreenToolV3.ShowSplashScreen(typeof(WaitForm1)); Thread.Sleep(5000); throw new Exception("ccccccccc"); ////Thread.Sleep(5000); //SplashScreenToolV3.SetCaption("正在開始下載...."); ////SplashScreenController.ShowSplashScreen(); //Thread _task1 = new Thread(() => //{ //  for (int i = 0; i < 100; i++) //  { //    SplashScreenToolV3.SetDescription(i.ToString() + "%"); //    Thread.Sleep(1000); //  } //}); //Thread _task2 = new Thread(() => //{ //  for (int i = 0; i < 100; i++) //  { //    SplashScreenToolV3.SetCaption("測試.." + i); //    Thread.Sleep(500); //  } //}); //_task1.Start(); //_task2.Start();}catch (Exception ex){ MessageBox.Show(ex.Message);}finally{ // SplashScreenController.HideSplashScreen();}

測試效果如下圖所示:

希望本文所述方法對打擊的C#程序設計能有所幫助!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 平阳县| 哈密市| 罗江县| 舞阳县| 自贡市| 尼木县| 泸水县| 昭觉县| 曲周县| 尼木县| 禹州市| 澄江县| 福鼎市| 拜城县| 卓资县| 北海市| 安康市| 库车县| 德钦县| 始兴县| 忻城县| 古田县| 武安市| 南澳县| 阿尔山市| 黑龙江省| 平安县| 吉安市| 霍林郭勒市| 桐庐县| 紫云| 长宁县| 泰顺县| 汝南县| 新闻| 乌兰察布市| 临颍县| 丰镇市| 陇南市| 邵阳市| 宁国市|