-
C#教程之DevExpress之SplashScreen用法实例
本文实例展示了DevExpress中SplashScreen的用法,对于C#初学者来说有一定的参考借鉴价值,具体用法如下:
关键代码部分如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
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); } } } } |
测试代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
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#程序设计能有所帮助!
栏目列表
最新更新
求1000阶乘的结果末尾有多少个0
详解MyBatis延迟加载是如何实现的
IDEA 控制台中文乱码4种解决方案
SpringBoot中版本兼容性处理的实现示例
Spring的IOC解决程序耦合的实现
详解Spring多数据源如何切换
Java报错:UnsupportedOperationException in Col
使用Spring Batch实现批处理任务的详细教程
java中怎么将多个音频文件拼接合成一个
SpringBoot整合ES多个精确值查询 terms功能实
数据库审计与智能监控:从日志分析到异
SQL Server 中的数据类型隐式转换问题
SQL Server中T-SQL 数据类型转换详解
sqlserver 数据类型转换小实验
SQL Server数据类型转换方法
SQL Server 2017无法连接到服务器的问题解决
SQLServer地址搜索性能优化
Sql Server查询性能优化之不可小觑的书签查
SQL Server数据库的高性能优化经验总结
SQL SERVER性能优化综述(很好的总结,不要错
uniapp/H5 获取手机桌面壁纸 (静态壁纸)
[前端] DNS解析与优化
为什么在js中需要添加addEventListener()?
JS模块化系统
js通过Object.defineProperty() 定义和控制对象
这是目前我见过最好的跨域解决方案!
减少回流与重绘
减少回流与重绘
如何使用KrpanoToolJS在浏览器切图
performance.now() 与 Date.now() 对比