DevExpress之SplashScreen用法实例
程序员文章站
2024-02-13 09:59:34
本文实例展示了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用法实例
-
CodeIgniter辅助之第三方类库third_party用法分析_php实例
-
Android控件之ProgressBar用法实例分析
-
php文件压缩之PHPZip类用法实例
-
YII2.0之Activeform表单组件用法实例_PHP
-
微信公众平台之快递查询功能用法实例,公众实例
-
CI框架源码解读之URI.php中_fetch_uri_string()函数用法分析_php实例
-
YII2.0之Activeform表单组件用法实例,yii2.0activeform
-
YII2.0之Activeform表单组件用法实例_PHP
-
Symfony2之session与cookie用法小结_php实例