/
XafSplashScreen.vb
56 lines (51 loc) · 1.99 KB
/
XafSplashScreen.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
Imports System
Imports System.Drawing
Imports System.IO
Imports System.Reflection
Imports DevExpress.ExpressApp.Win.Utils
Imports DevExpress.Skins
Imports DevExpress.Utils.Drawing
Imports DevExpress.Utils.Svg
Imports DevExpress.XtraSplashScreen
Namespace NonPersistentObjectsDemo.Win
Partial Public Class XafSplashScreen
Inherits SplashScreen
Private Sub LoadBlankLogo()
Dim assembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
Dim blankLogoResourceName As String = assembly.GetName().Name & ".Images.Logo.svg"
Dim svgStream As Stream = assembly.GetManifestResourceStream(blankLogoResourceName)
If svgStream IsNot Nothing Then
svgStream.Position = 0
peLogo.SvgImage = SvgImage.FromStream(svgStream)
End If
End Sub
Protected Overrides Sub DrawContent(ByVal graphicsCache As GraphicsCache, ByVal skin As Skin)
Dim bounds As Rectangle = ClientRectangle
bounds.Width -= 1
bounds.Height -= 1
graphicsCache.Graphics.DrawRectangle(graphicsCache.GetPen(Color.FromArgb(255, 87, 87, 87), 1), bounds)
End Sub
Protected Sub UpdateLabelsPosition()
labelApplicationName.CalcBestSize()
Dim newLeft As Integer = (Width - labelApplicationName.Width) \ 2
labelApplicationName.Location = New Point(newLeft, labelApplicationName.Top)
labelSubtitle.CalcBestSize()
newLeft = (Width - labelSubtitle.Width) \ 2
labelSubtitle.Location = New Point(newLeft, labelSubtitle.Top)
End Sub
Public Sub New()
InitializeComponent()
LoadBlankLogo()
Me.labelCopyright.Text = "Copyright © " & DateTime.Now.Year.ToString() & " Company Name" & Environment.NewLine & "All rights reserved."
UpdateLabelsPosition()
End Sub
#Region "Overrides"
Public Overrides Sub ProcessCommand(ByVal cmd As System.Enum, ByVal arg As Object)
MyBase.ProcessCommand(cmd, arg)
If CType(cmd, UpdateSplashCommand) = UpdateSplashCommand.Description Then
labelStatus.Text = DirectCast(arg, String)
End If
End Sub
#End Region
End Class
End Namespace