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