DevExpress之SplashScreen用法實(shí)例
本文實(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); } } } }
測(cè)試代碼如下:
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("測(cè)試.." + i); // Thread.Sleep(500); // } //}); //_task1.Start(); //_task2.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { // SplashScreenController.HideSplashScreen(); }
測(cè)試效果如下圖所示:
希望本文所述方法對(duì)打擊的C#程序設(shè)計(jì)能有所幫助!
- 正則表達(dá)式regular expression詳述(一)
- 用用outlook Express 由于服務(wù)器拒絕接受發(fā)件人的電子郵件地址,這封郵件無法發(fā)送
- Sql server 2008 express遠(yuǎn)程登錄實(shí)例設(shè)置 圖文教程
- nodejs教程 安裝express及配置app.js文件的詳細(xì)步驟
- DevExpress SplitContainerControl用法總結(jié)
- DevExpress之TreeList用法實(shí)例總結(jié)
- SQL2005Express中導(dǎo)入ACCESS數(shù)據(jù)庫(kù)的兩種方法
- DevExpress之ChartControl實(shí)現(xiàn)餅狀圖百分比演示實(shí)例
- DevExpress之ChartControl實(shí)現(xiàn)柱狀圖演示實(shí)例
- node+express+ejs制作簡(jiǎn)單頁面上手指南
- express的中間件bodyParser詳解
- express的中間件cookieParser詳解
- 在WIN7下安裝和配置SQL Server 2005 Express Edition(精簡(jiǎn)版)
- C#實(shí)現(xiàn)DevExpress本地化實(shí)例詳解
- Express的路由詳解
相關(guān)文章
C#創(chuàng)建Windows Service(Windows 服務(wù))的方法步驟
本文介紹了如何用C#創(chuàng)建、安裝、啟動(dòng)、監(jiān)控、卸載簡(jiǎn)單的Windows Service 的內(nèi)容步驟和注意事項(xiàng),具有一定的參考價(jià)值,感興趣的可以了解一下2023-11-11Unity向量按照某一點(diǎn)進(jìn)行旋轉(zhuǎn)
這篇文章主要為大家詳細(xì)介紹了Unity向量按照某一點(diǎn)進(jìn)行旋轉(zhuǎn),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-01-01Unity UGUI的EventTrigger事件監(jiān)聽器組件介紹使用示例
這篇文章主要為大家介紹了Unity UGUI的EventTrigger事件監(jiān)聽器組件介紹及使用,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-08-08深入了解c# 設(shè)計(jì)模式之簡(jiǎn)單工廠模式
這篇文章主要介紹了c# 設(shè)計(jì)模式之簡(jiǎn)單工廠模式的的相關(guān)資料,文中代碼非常詳細(xì),幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下2020-06-06C#實(shí)現(xiàn)讀取注冊(cè)表監(jiān)控當(dāng)前操作系統(tǒng)已安裝軟件變化的方法
這篇文章主要介紹了C#實(shí)現(xiàn)讀取注冊(cè)表監(jiān)控當(dāng)前操作系統(tǒng)已安裝軟件變化的方法,涉及C#針對(duì)注冊(cè)表的讀取與監(jiān)控技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-08-08c# 如何使用結(jié)構(gòu)體實(shí)現(xiàn)共用體
這篇文章主要介紹了c# 如何使用結(jié)構(gòu)體實(shí)現(xiàn)共用體,幫助大家更好的理解和學(xué)習(xí)使用c#,感興趣的朋友可以了解下2021-04-04c#將字節(jié)數(shù)組轉(zhuǎn)成易讀的字符串的實(shí)現(xiàn)
這篇文章主要介紹了c#將字節(jié)數(shù)組轉(zhuǎn)成易讀的字符串的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-01-01C#使用Json.Net對(duì)JSON與對(duì)象的序列化與反序列化
這篇文章介紹了Json.Net對(duì)JSON與對(duì)象的序列化與反序列化,文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-05-05