Dev 等待提示 WaitDialogForm 升级版
本文轉載:http://www.cnblogs.com/VincentLuo/archive/2011/12/24/2298916.html
??一、Dev的等待提示框 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
用過Devexpress的用戶都知道,Dev自帶了默認的等待進度提示框,效果如下:
簡單使用代碼:
WaitDialogForm sdf = new WaitDialogForm("提示", "正在登錄......");for (int j = 1; j < i; j++)
{
Thread.Sleep(3000);
sdf.SetCaption("執行進度(" + j.ToString() + "/" + i.ToString() + ")");
}
sdf.Close();
在中間我加入了3秒等待時間,否則,提示框閃的太快。
這里在創建對象的時候,帶入了兩個參數,當然還有其他更多的參數,可以對字體進行設置,等待圖片進行設置等。
?二、我改過的另外版的等待提示框 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ?先出具下效果看看:
我把dev的等待圖片改成了progressbarcontrol,這樣更能看到進度的進展。我將窗體更名為:ShowDialogForm。
為了能看到效果,我加了一個循環來顯示執行進度,并用進度條來友好提示,如果是遇到大量的數據庫,就不需要此循環了
簡單使用代碼:
int i = 1999;ShowDialogForm sdf = new ShowDialogForm("提示", "正在登錄......","請耐心等候,正在驗證您的身份!",i);
for (int j = 1; j < i; j++)
{
sdf.SetCaption("執行進度(" + j.ToString() + "/" + i.ToString() + ")");
}
login();
sdf.Close();
?
ShowDialogForm等待窗體的主要代碼:
/// <summary>/// 設置
/// </summary>
/// <param name="_caption">提示</param>
/// <param name="_message">消息內容</param>
/// <param name="_content">詳細描述</param>
/// <param name="_maxProcess">進度條最大值</param>
public ShowDialogForm(string _caption, string _message,string _content,int _maxProcess)
: this()
{
this.Caption = "";
this.Message = "";
this.Content = "";
this.Caption = _caption == "" ? "提示" : _caption;
this.Message = _message == "" ? "正在加載,請稍后......" : _message;
this.Content = _content;
this.maxProcess = _maxProcess > this.MinProcess ? _maxProcess : MinProcess;
lblCaption.Text = this.Caption;
lblMessage.Text = this.Message;
lblContent.Text = this.Content;
progressShow.Properties.Minimum = MinProcess;
progressShow.Properties.Maximum = MaxProcess;
progressShow.Properties.Step = 1;
progressShow.PerformStep();
this.ShowInTaskbar = false;
this.TopMost = true;
this.Show();
this.Refresh();
}
?
最好附上整個ShowDialogForm等待窗體文件
點擊下載
轉載于:https://www.cnblogs.com/51net/p/4015312.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的Dev 等待提示 WaitDialogForm 升级版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 分形之龙形曲线(Dragon Curve
- 下一篇: 依赖注入容器Autofac的详解[转]