Dev异步加载动画图片等待窗体frmWaiting,WaitForm,SplashScreenManager
Dev异步加载动画图片等待窗体frmWaiting,WaitForm,SplashScreenManager
支持异步的动画图片等待窗体frmWaiting
扫一扫加微信
支持异步的动画图片等待窗体frmWaiting
frmWaitForm继承DevExpress.XtraWaitForm.WaitForm:
C# Code:
/// <summary>
/// 等待窗体
/// </summary>
internal partial class frmWaitForm : WaitForm
{
public frmWaitForm()
{
InitializeComponent();
this.progressPanel1.AutoHeight = true;
}
#region Overrides
public override void SetCaption(string caption)
{
base.SetCaption(caption);
this.progressPanel1.Caption = caption;
}
public override void SetDescription(string description)
{
base.SetDescription(description);
this.progressPanel1.Description = description;
}
public override void ProcessCommand(Enum cmd, object arg)
{
base.ProcessCommand(cmd, arg);
}
#endregion
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// 等待窗体
/// </summary>
internal partial class frmWaitForm : WaitForm
{
public frmWaitForm()
{
InitializeComponent();
this.progressPanel1.AutoHeight = true;
}
#region Overrides
public override void SetCaption(string caption)
{
base.SetCaption(caption);
this.progressPanel1.Caption = caption;
}
public override void SetDescription(string description)
{
base.SetDescription(description);
this.progressPanel1.Description = description;
}
public override void ProcessCommand(Enum cmd, object arg)
{
base.ProcessCommand(cmd, arg);
}
#endregion
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
使用SplashScreenManager类的ShowForm方法打开等待窗体:
C# Code:
/// <summary>
/// 调用类
/// </summary>
public class frmWaiting
{
public static void ShowMe(Form owner, string message)
{
SplashScreenManager.ShowForm(owner, typeof(frmWaitForm), true, true, false);
SplashScreenManager.Default.SetWaitFormDescription(message);
}
public static void ShowMe(Form owner)
{
SplashScreenManager.ShowForm(owner, typeof(frmWaitForm), true, true, false);
}
public static void HideMe(Form owner)
{
SplashScreenManager.CloseForm(false, 0, owner);
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// 调用类
/// </summary>
public class frmWaiting
{
public static void ShowMe(Form owner, string message)
{
SplashScreenManager.ShowForm(owner, typeof(frmWaitForm), true, true, false);
SplashScreenManager.Default.SetWaitFormDescription(message);
}
public static void ShowMe(Form owner)
{
SplashScreenManager.ShowForm(owner, typeof(frmWaitForm), true, true, false);
}
public static void HideMe(Form owner)
{
SplashScreenManager.CloseForm(false, 0, owner);
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
测试按钮:
C# Code:
private void btn测试frmWaiting_Click(object sender, EventArgs e)
{
CSFrameworkV5.Library.CommonForms.frmWaiting.ShowMe(this, "测试异步等待窗体");
Application.DoEvents();
Thread.Sleep(3000);
CSFrameworkV5.Library.CommonForms.frmWaiting.HideMe(this);
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
{
CSFrameworkV5.Library.CommonForms.frmWaiting.ShowMe(this, "测试异步等待窗体");
Application.DoEvents();
Thread.Sleep(3000);
CSFrameworkV5.Library.CommonForms.frmWaiting.HideMe(this);
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
扫一扫加微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网