This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
/
Form1.vb
73 lines (62 loc) · 2.18 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Reflection
Imports System.IO
Imports DevExpress.XtraEditors
Imports DevExpress.Utils
Imports DevExpress.Skins
Namespace WindowsApplication1
Partial Public Class Form1
Inherits XtraForm
Private Shared Function GetLibraryName(ByVal type As DynamicSkinType) As String
Return String.Format("DevExpress.{0}Skins{1}.dll", type, AssemblyInfo.VSuffix)
End Function
Private Overloads Function ShowDialog(ByVal type As DynamicSkinType) As String
Dim dialog As New OpenFileDialog()
dialog.FileName = GetLibraryName(type)
dialog.ShowDialog()
Return dialog.FileName
End Function
Private Sub LoadDynamicSkin(ByVal type As DynamicSkinType)
Dim fileName As String = ShowDialog(type)
If File.Exists(fileName) Then
Dim SampleAssembly As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile(fileName)
DevExpress.Skins.SkinManager.Default.RegisterAssembly(SampleAssembly)
PopulateListBox()
Else
MessageBox.Show(String.Format("File not found ({0})", fileName))
End If
End Sub
Private Sub PopulateListBox()
listBoxControl1.Items.Clear()
For Each skin As SkinContainer In SkinManager.Default.Skins
listBoxControl1.Items.Add(skin.SkinName)
Next skin
End Sub
Public Sub New()
InitializeComponent()
PopulateListBox()
End Sub
Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton1.Click
LoadDynamicSkin(DynamicSkinType.Office)
End Sub
Private Sub listBoxControl1_SelectedValueChanged(ByVal sender As Object, ByVal e As EventArgs) Handles listBoxControl1.SelectedValueChanged
If listBoxControl1.SelectedValue IsNot Nothing Then
defaultLookAndFeel1.LookAndFeel.SkinName = listBoxControl1.SelectedValue.ToString()
End If
End Sub
Private Sub simpleButton2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton2.Click
LoadDynamicSkin(DynamicSkinType.Bonus)
End Sub
End Class
Friend Enum DynamicSkinType
Office
Bonus
End Enum
End Namespace