XAF自定義啟動頁
本主題是官網指導教程 Use a Custom Class to Show a Splash Form 的補充。演示瞭如何建立自定義啟動頁(splash form
)並使用。
具體步驟
1. 建立一個Splash Form窗體
右鍵解決方案中的WinForms應用工程(xxx.win),在彈出選單中選擇"新增"->“新建項”。
在彈出的窗體中點選 “Windows Form” -> “窗體(Windows 窗體)”,在窗體的最下方的名稱中輸入檔名"SplashScreenForm.cs
",隨後點選右下角的"新增"按鈕。
此時在WinForms資料夾中已經可以看到剛剛建立的SplashScreenForm.cs
檔案。
2.建立繼承 ISplash
介面的類。
右鍵解決方案中的WinForms應用工程(xxx.win),在彈出選單中選擇"新增"->“類”。
在彈出的窗體中輸入檔名稱"MySplash.cs
",然後點選 “新增” 按鈕。
在WinForms應用工程(xxx.win)中雙擊 MySplash.cs
檔案。將檔案程式碼替換成以下的內容:
using DevExpress.ExpressApp.Win;
//...
public class MySplash : ISplash {
static private SplashScreenForm form;
private static bool isStarted = false;
public void Start() {
isStarted = true;
form = new SplashScreenForm();
form.Show();
System.Windows.Forms.Application.DoEvents();
}
public void Stop() {
if(form != null) {
form.Hide();
form.Close();
form = null;
}
isStarted = false;
}
public void SetDisplayText(string displayText) {
}
public bool IsStarted {
get { return isStarted; }
}
}
3. 引用MySplash類
訪問 WinApplication.cs
檔案。將SplashScreen
屬性設定為新的 MySplash
類例項。
using System;
// ……
namespace MySolution.Win {
public partial class MySolutionWindowsFormsApplication : WinApplication {
public MySolutionWindowsFormsApplication() {
InitializeComponent();
SplashScreen = new MySplash();
}
}
}
4. 在設計器中自定義啟動介面
雙擊 SplashScreenForm.cs
進入設計器。初始化的窗體是帶有邊框的,可以在屬性皮膚中設定 “FormBorderStyle
” 為 None
去除邊框。
點選"工具箱",分批次拖拽兩個"Label"和一個"PictureBox"外掛進入設計器中,完成介面的設計。
此時點選屬性皮膚的標題,應該出現以下所示的4個介面結構單位。要實現官網中展示的最終效果,需要在幾個介面結構中調整必要的引數。
5. 實現顯示載入進度資訊的功能
為了實現顯示載入進度資訊的功能,請在 MySplash
類中實現 ISupportUpdateSplash
介面,並將 UpdateInfo
方法新增到 SplashScreenForm
類中。
public class MySplash : ISplash, ISupportUpdateSplash {
// ...
public void UpdateSplash(string caption, string description, params object[] additionalParams) {
form.UpdateInfo(description);
}
}
// ...
public partial class SplashScreenForm : Form {
// ...
internal void UpdateInfo(string info) {
label2.Text = info;
}
}
相關文章
- 修改原始碼,自定義chromium啟動頁原始碼
- 自定義View( 啟動頁倒數計時)View
- 前端頁面自定義滾動條前端
- 自定義springboot啟動器Spring Boot
- 自定義View_手擼一個啟動頁倒數計時ViewView
- Oracle RAC的自定義service自啟動Oracle
- docker Redis 自定義配置檔案啟動DockerRedis
- 自定義分頁格式
- win10怎麼自定義開機啟動項_win10自定義開機啟動項的方法Win10
- 記windows自定義bat指令碼自啟動WindowsBAT指令碼
- GridView 自定義模版自定義修改,刪除,分頁View
- JavaWeb 自定義404頁面JavaWeb
- 自定義u-boot啟動logo的方法bootGo
- 適合最新版docker自定義啟動配置Docker
- 如何自定義Safari的起始頁
- 自定義OAM錯誤頁面
- Swift - 自定義Share分享頁面Swift
- wordpress 自定義路由及展示頁路由
- 自定義分頁控制元件控制元件
- spring boot啟動掃描不到自定義註解Spring Boot
- 自定義滾動條
- 自定義滾動文字
- 教你自定義Flutter錯誤頁面Flutter
- 自定義分頁標籤詳解
- Appfuse:新增自定義頁面元件APP元件
- 自定義處理頁面請求
- 自定義登入和登出頁面
- django 自定義分頁與bootstrap分頁結合Djangoboot
- win10自定義禁用系統啟動項的方法Win10
- Docker 自定義網橋後,無法正常啟動問題Docker
- win10啟動項在哪裡設定 win10自定義開機啟動項Win10
- 自定義模型怎麼在首頁呼叫?模型
- html頁面自定義文字水印效果案例HTML
- DataTables自定義分頁條數實現
- Laravel 自定義 Markdown 電子郵件頁首和頁尾Laravel
- ThinkPHP框架中自定義錯誤頁面和提示頁面PHP框架
- IDEA 啟動時 自定義配置-只是看一下而已--註冊啟用Idea
- 使用自定義按鍵啟動軟體 Thor 1.5.2 Mac中文版Mac