应用界面表单美化 - 动态更新Wait Form的标题或描述
DevExpress技术交流群3:700924826 欢迎一起进群讨论
启动屏幕管理器在单独的线程中显示Wait Form,若要在显示Wait Form时动态更改标签,请使用SplashScreenManager.SetWaitFormCaption和SetWaitFormDescription方法。
注意:完成的示例项目位于https://github.com/DevExpress-Examples/how-to-dynamically-change-a-wait-forms-labels-e3575。
Form1.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraSplashScreen; using System.Threading; namespace WaitForm_SetDescription { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnShowWaitForm_Click(object sender, EventArgs e) { //Open Wait Form SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false); //The Wait Form is opened in a separate thread. To change its Description, use the SetWaitFormDescription method. for (int i = 1; i <= 100; i++) { SplashScreenManager.Default.SetWaitFormDescription(i.ToString() + "%"); Thread.Sleep(25); } //Close Wait Form SplashScreenManager.CloseForm(false); } } }
Form1.vb
Imports Microsoft.VisualBasic Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Linq Imports System.Text Imports System.Windows.Forms Imports DevExpress.XtraSplashScreen Imports System.Threading Namespace WaitForm_SetDescription Partial Public Class Form1 Inherits Form Public Sub New() InitializeComponent() End Sub Private Sub btnShowWaitForm_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnShowWaitForm.Click 'Open Wait Form SplashScreenManager.ShowForm(Me, GetType(WaitForm1), True, True, False) 'The Wait Form is opened in a separate thread. To change its Description, use the SetWaitFormDescription method. For i As Integer = 1 To 100 SplashScreenManager.Default.SetWaitFormDescription(i.ToString() & "%") Thread.Sleep(25) Next i 'Close Wait Form SplashScreenManager.CloseForm(False) End Sub End Class End Namespace
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
2020-03-04 ASP.NET Core 3时代到来!DevExpress v19.2抢先支持
2019-03-04 DevExpress ASP.NET Core Controls v18.2新功能详解