ProgressPanel Class |
控件 指示進度條
Assembly:DevExpress.XtraEditors.vXX.dll
|
||||||
|
爲一個進度條控件
每一個皮膚ProgressPanel包含自己的動畫圖片.
許多方式可以選擇皮膚。
LookAndFeel.UseDefaultLookAndFeel =true或者 UseDefaultLookAndFeel =false並設置LookAndFeel屬性的SkinName屬性
下面是皮膚示例。
如果需要在單獨的窗體顯示進度面板,使用WaitForm ,它由 SplashScreenManager 負責管理。
---------------------------------------------Namespace:DevExpress.XtraWaitForm
Assembly:DevExpress.XtraEditors.
|
||||||
|
A WaitForm 包含一個動畫圖像 (由當前皮膚獲取) and 兩個自定義標籤(標題和描述) :
To create a Wait Form, drop a SplashScreenManager component onto your form, click the component's tag and then click the Add Wait Form link in the SplashScreenManager Tasks window that will open:
This generates a WaitForm's descendant that you can modify at design time.
A Wait Form 需要手動控制顯示, 使用SplashScreenManager 提供的方法,主要控制方法爲:
splashScreenManager.ShowWaitForm();
splashScreenManager.CloseWaitForm();
-------------------------------------------SplashScreenManager -----------------------------------
splashScreenManager這個控件的主要作用就是顯示程序集加載之前的進度條顯示和進行耗時操作時候的等待界面。窗體加載完成後會自動消失。可以通過在
private void MainForm_Load(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
}
測試。
1.新建一個Windows窗體,在工具欄Navigation和Layout中找到SplashScreenManager,把它拖放到Windows窗體中。
2.找到這個控件,點擊右上角的三角圖標,出現如下顯示的下拉菜單,點擊“Add Splash Screen”然後打開解決方案資源管理器,你會發現多了一個名爲“SplashScreen1.cs”的窗體,打開它,如下圖所示:
3.兩個圖片、標籤控件和一個進度條控件,可以根據自己的需要進行修改。
4.然後在程序入口出加上如下代碼,就可以顯示在程序加載之前顯示進度條了(不添加下面的代碼一樣可以顯示效果)
第二種方式:添加“正在加載"
點擊splashScreenManager1控件右上角的三角圖標,出現如下顯示的下拉菜單,點擊“Add Wait Form”然後打開解決方案資源管理器,你會發現多了一個名爲“WaitForm1.cs”的窗體,打開它,如下圖所示:
在按鈕單擊事件中加入如下代碼:就可以實現“正在加載”的提示了。