文檔金喜正規買球>>DevExpress WinForm中文手冊>>自定義皮膚注冊
自定義皮膚注冊
將皮膚庫添加到項目中,并在應用程序啟動時調用皮膚注冊代碼。
注冊 DevExpress.BonusSkins 庫
您可以注冊BonusSkins庫并在設計時對項目設置頁面,如果主表單繼承自XtraForm類或其子類,則項目設置和BonusSkins庫注冊代碼將自動應用于表單的創建。
您也可以在代碼中用DevExpress.UserSkins.BonusSkins.Register方法注冊BonusSkins庫,方法是在應用程序啟動時調用它。
C#:
[STAThread] static void Main() { // Skin registration. DevExpress.UserSkins.BonusSkins.Register(); Application.Run(new Form1()); }
VB.NET:
<STAThread> _ Shared Sub Main() DevExpress.UserSkins.BonusSkins.Register() '... Application.Run(New frmMain()) End Sub
注冊自定義皮膚
對于自定義皮膚,您可以從 中獲取皮膚注冊碼。
以下示例顯示了示例 SkinProject1 庫的注冊代碼。
C#:
[STAThread] static void Main() { //If your custom skin is derived from a template skin that resides in the BonusSkins library, ensure that you register the template skin first using the BonusSkins.Register method. //DevExpress.UserSkins.BonusSkins.Register() Assembly asm = typeof(DevExpress.UserSkins.SkinProject1).Assembly; DevExpress.Skins.SkinManager.Default.RegisterAssembly(asm); Application.Run(new Form1()); }
VB.NET:
<STAThread> _ Shared Sub Main() 'If a custom skin's template resides in the BonusSkins library, ensure that you register the template skin first, using the BonusSkins.Register method. 'DevExpress.UserSkins.BonusSkins.Register() Dim asm As Assembly = GetType(DevExpress.UserSkins.SkinProject1).Assembly DevExpress.Skins.SkinManager.Default.RegisterAssembly(asm) Application.Run(New frmMain()) End Sub
提示:如果自定義皮膚的模板駐留在BonusSkins庫中,請確保首先使用BonusSkinsRegister方法注冊模板皮膚,如上所示。
注冊自定義皮膚用于啟動屏幕和等待表單中使用
用組件創建的啟動屏幕和等待表單在另一個線程中運行,在主線程中注冊的自定義皮膚信息在閃屏線程中是不可用的,直到您調用方法。
C#:
SplashScreenManager.RegisterUserSkins(typeof(DevExpress.UserSkins.SkinProject1).Assembly); splashScreenManager1.ShowWaitForm();
VB.NET:
SplashScreenManager.RegisterUserSkins(GetType(DevExpress.UserSkins.SkinProject1).Assembly) splashScreenManager1.ShowWaitForm()
如果自定義皮膚是從位于BonusSkins庫中的一個模板皮膚派生的,在調用SplashScreenManagerRegisterUserSkins方法之前,請先在主線程中注冊BonusSkins庫。