最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

DevExpress之SplashScreen用法實(shí)例

 更新時(shí)間:2014年08月20日 09:09:25   投稿:shichen2014  
這篇文章主要介紹了DevExpress中SplashScreen的用法,對(duì)于C#初學(xué)者有很好的參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例展示了DevExpress中SplashScreen的用法,對(duì)于C#初學(xué)者來說有一定的參考借鑒價(jià)值,具體用法如下:

關(guān)鍵代碼部分如下:

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">需要設(shè)置的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">需要設(shè)置的文字提示信息</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();
}

測試效果如下圖所示:

希望本文所述方法對(duì)打擊的C#程序設(shè)計(jì)能有所幫助!

相關(guān)文章

最新評(píng)論

三门峡市| 双牌县| 鄄城县| 沂源县| 探索| 新民市| 龙海市| 铅山县| 康定县| 西宁市| 南涧| 铁岭县| 黄大仙区| 双城市| 饶平县| 彭阳县| 兴仁县| 本溪| 克什克腾旗| 抚远县| 民丰县| 灵山县| 建湖县| 台前县| 呼伦贝尔市| 武威市| 南充市| 湘乡市| 柳河县| 西畴县| 正阳县| 合作市| 凌海市| 阳东县| 蒙城县| 阿坝县| 太和县| 昌宁县| 鄂托克旗| 万山特区| 枣阳市|