时间:2021-05-20
本文实例展示了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#程序设计能有所帮助!
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
本文实例总结了DevExpress之TreeList用法,希望对大家学习C#程序设计起到一定的帮助作用。具体实例如下:usingSystem;usingSyst
本文实例讲述了DevExpress之ChartControl的SeriesTemplate用法,分享给大家供大家参考。具体方法如下:关键代码如下:复制代码代码如
本文实例讲述了Android开发基础之创建启动界面SplashScreen的方法。分享给大家供大家参考。具体如下:启动界面SplashScreen在应用程序是很
DevExpress中的ChartControl顾名思义就是数据基于图表展示,其关键在于Series上的处理。本文实例展示了ChartControl的用法,具体
本文实例讲述了DevExpress之饼状图突出(Explode)设置方法,分享给大家供大家参考。具体实现方法如下:关键代码如下:复制代码代码如下://////饼