DevExpress之SplashScreen用法实例
程序员文章站
2023-12-17 21:45:52
本文实例展示了devexpress中splashscreen的用法,对于c#初学者来说有一定的参考借鉴价值,具体用法如下:
关键代码部分如下:
using de...
本文实例展示了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#程序设计能有所帮助!
推荐阅读
-
DevExpress之SplashScreen用法实例
-
C#基础之Lambda表达式用法实例教程
-
C#基础之委托用法实例教程
-
Android编程开发之RadioGroup用法实例
-
Android编程开发之Spinner控件用法实例分析
-
Android编程布局(Layout)之AbsoluteLayout用法实例分析
-
DevExpress之ChartControl创建Drill-Down样式的Title实例
-
Android编程布局控件之AbsoluteLayout用法实例分析
-
DevExpress之ChartControl的SeriesTemplate实例
-
DevExpress之ChartControl实现柱状图演示实例