Dev异步加载动画图片等待窗体frmWaiting,WaitForm,SplashScreenManager
作者:作者不详  发布日期:2020/04/07 17:01:37
  Dev异步加载动画图片等待窗体frmWaiting,WaitForm,SplashScreenManager

Dev异步加载动画图片等待窗体frmWaiting,WaitForm,SplashScreenManager


支持异步的动画图片等待窗体frmWaiting


贴图图片-支持异步的动画图片等待窗体frmWaiting



frmWaitForm继承DevExpress.XtraWaitForm.WaitForm:


贴图图片-支持异步的动画图片等待窗体frmWaiting1


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



使用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



测试按钮:


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



C/S框架网|原创精神.创造价值.打造精品

扫一扫加微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务

上一篇 下一篇