Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.Drawing.Imaging
- Imports System.Drawing.Drawing2D
- Imports System.ComponentModel
- Imports System.Runtime.InteropServices
- #Region "Themebase"
- '------------------
- 'Creator: aeonhack
- 'Site: elitevs.net
- 'Created: 08/02/2011
- 'Changed: 12/06/2011
- 'Version: 1.5.4
- '------------------
- MustInherit Class ThemeContainer154
- Inherits ContainerControl
- #Region " Initialization "
- Protected G As Graphics, B As Bitmap
- Sub New()
- SetStyle(DirectCast(139270, ControlStyles), True)
- _ImageSize = Size.Empty
- Font = New Font("Verdana", 10S, FontStyle.Bold)
- MeasureBitmap = New Bitmap(1, 1)
- MeasureGraphics = Graphics.FromImage(MeasureBitmap)
- DrawRadialPath = New GraphicsPath
- InvalidateCustimization()
- End Sub
- Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
- If DoneCreation Then InitializeMessages()
- InvalidateCustimization()
- ColorHook()
- If Not _LockWidth = 0 Then Width = _LockWidth
- If Not _LockHeight = 0 Then Height = _LockHeight
- If Not _ControlMode Then MyBase.Dock = DockStyle.Fill
- Transparent = _Transparent
- If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
- MyBase.OnHandleCreated(e)
- End Sub
- Private DoneCreation As Boolean
- Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
- MyBase.OnParentChanged(e)
- If Parent Is Nothing Then Return
- _IsParentForm = TypeOf Parent Is Form
- If Not _ControlMode Then
- InitializeMessages()
- If _IsParentForm Then
- ParentForm.FormBorderStyle = _BorderStyle
- ParentForm.TransparencyKey = _TransparencyKey
- If Not DesignMode Then
- AddHandler ParentForm.Shown, AddressOf FormShown
- End If
- End If
- Parent.BackColor = BackColor
- End If
- OnCreation()
- DoneCreation = True
- InvalidateTimer()
- End Sub
- #End Region
- Private Sub DoAnimation(ByVal i As Boolean)
- OnAnimation()
- If i Then Invalidate()
- End Sub
- Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
- If Width = 0 OrElse Height = 0 Then Return
- If _Transparent AndAlso _ControlMode Then
- PaintHook()
- e.Graphics.DrawImage(B, 0, 0)
- Else
- G = e.Graphics
- PaintHook()
- End If
- End Sub
- Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
- RemoveAnimationCallback(AddressOf DoAnimation)
- MyBase.OnHandleDestroyed(e)
- End Sub
- Private HasShown As Boolean
- Private Sub FormShown(ByVal sender As Object, ByVal e As EventArgs)
- If _ControlMode OrElse HasShown Then Return
- If _StartPosition = FormStartPosition.CenterParent OrElse _StartPosition = FormStartPosition.CenterScreen Then
- Dim SB As Rectangle = Screen.PrimaryScreen.Bounds
- Dim CB As Rectangle = ParentForm.Bounds
- ParentForm.Location = New Point(SB.Width \ 2 - CB.Width \ 2, SB.Height \ 2 - CB.Width \ 2)
- End If
- HasShown = True
- End Sub
- #Region " Size Handling "
- Private Frame As Rectangle
- Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
- If _Movable AndAlso Not _ControlMode Then
- Frame = New Rectangle(7, 7, Width - 14, _Header - 7)
- End If
- InvalidateBitmap()
- Invalidate()
- MyBase.OnSizeChanged(e)
- End Sub
- Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
- If Not _LockWidth = 0 Then width = _LockWidth
- If Not _LockHeight = 0 Then height = _LockHeight
- MyBase.SetBoundsCore(x, y, width, height, specified)
- End Sub
- #End Region
- #Region " State Handling "
- Protected State As MouseState
- Private Sub SetState(ByVal current As MouseState)
- State = current
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
- If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized) Then
- If _Sizable AndAlso Not _ControlMode Then InvalidateMouse()
- End If
- MyBase.OnMouseMove(e)
- End Sub
- Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
- If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
- MyBase.OnEnabledChanged(e)
- End Sub
- Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
- SetState(MouseState.Over)
- MyBase.OnMouseEnter(e)
- End Sub
- Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
- SetState(MouseState.Over)
- MyBase.OnMouseUp(e)
- End Sub
- Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
- SetState(MouseState.None)
- If GetChildAtPoint(PointToClient(MousePosition)) IsNot Nothing Then
- If _Sizable AndAlso Not _ControlMode Then
- Cursor = Cursors.Default
- Previous = 0
- End If
- End If
- MyBase.OnMouseLeave(e)
- End Sub
- Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
- If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
- If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized OrElse _ControlMode) Then
- If _Movable AndAlso Frame.Contains(e.Location) Then
- Capture = False
- WM_LMBUTTONDOWN = True
- DefWndProc(Messages(0))
- ElseIf _Sizable AndAlso Not Previous = 0 Then
- Capture = False
- WM_LMBUTTONDOWN = True
- DefWndProc(Messages(Previous))
- End If
- End If
- MyBase.OnMouseDown(e)
- End Sub
- Private WM_LMBUTTONDOWN As Boolean
- Protected Overrides Sub WndProc(ByRef m As Message)
- MyBase.WndProc(m)
- If WM_LMBUTTONDOWN AndAlso m.Msg = 513 Then
- WM_LMBUTTONDOWN = False
- SetState(MouseState.Over)
- If Not _SmartBounds Then Return
- If IsParentMdi Then
- CorrectBounds(New Rectangle(Point.Empty, Parent.Parent.Size))
- Else
- CorrectBounds(Screen.FromControl(Parent).WorkingArea)
- End If
- End If
- End Sub
- Private GetIndexPoint As Point
- Private B1, B2, B3, B4 As Boolean
- Private Function GetIndex() As Integer
- GetIndexPoint = PointToClient(MousePosition)
- B1 = GetIndexPoint.X < 7
- B2 = GetIndexPoint.X > Width - 7
- B3 = GetIndexPoint.Y < 7
- B4 = GetIndexPoint.Y > Height - 7
- If B1 AndAlso B3 Then Return 4
- If B1 AndAlso B4 Then Return 7
- If B2 AndAlso B3 Then Return 5
- If B2 AndAlso B4 Then Return 8
- If B1 Then Return 1
- If B2 Then Return 2
- If B3 Then Return 3
- If B4 Then Return 6
- Return 0
- End Function
- Private Current, Previous As Integer
- Private Sub InvalidateMouse()
- Current = GetIndex()
- If Current = Previous Then Return
- Previous = Current
- Select Case Previous
- Case 0
- Cursor = Cursors.Default
- Case 1, 2
- Cursor = Cursors.SizeWE
- Case 3, 6
- Cursor = Cursors.SizeNS
- Case 4, 8
- Cursor = Cursors.SizeNWSE
- Case 5, 7
- Cursor = Cursors.SizeNESW
- End Select
- End Sub
- Private Messages(8) As Message
- Private Sub InitializeMessages()
- Messages(0) = Message.Create(Parent.Handle, 161, New IntPtr(2), IntPtr.Zero)
- For I As Integer = 1 To 8
- Messages(I) = Message.Create(Parent.Handle, 161, New IntPtr(I + 9), IntPtr.Zero)
- Next
- End Sub
- Private Sub CorrectBounds(ByVal bounds As Rectangle)
- If Parent.Width > bounds.Width Then Parent.Width = bounds.Width
- If Parent.Height > bounds.Height Then Parent.Height = bounds.Height
- Dim X As Integer = Parent.Location.X
- Dim Y As Integer = Parent.Location.Y
- If X < bounds.X Then X = bounds.X
- If Y < bounds.Y Then Y = bounds.Y
- Dim Width As Integer = bounds.X + bounds.Width
- Dim Height As Integer = bounds.Y + bounds.Height
- If X + Parent.Width > Width Then X = Width - Parent.Width
- If Y + Parent.Height > Height Then Y = Height - Parent.Height
- Parent.Location = New Point(X, Y)
- End Sub
- #End Region
- #Region " Base Properties "
- Overrides Property Dock As DockStyle
- Get
- Return MyBase.Dock
- End Get
- Set(ByVal value As DockStyle)
- If Not _ControlMode Then Return
- MyBase.Dock = value
- End Set
- End Property
- Private _BackColor As Boolean
- <Category("Misc")> _
- Overrides Property BackColor() As Color
- Get
- Return MyBase.BackColor
- End Get
- Set(ByVal value As Color)
- If value = MyBase.BackColor Then Return
- If Not IsHandleCreated AndAlso _ControlMode AndAlso value = Color.Transparent Then
- _BackColor = True
- Return
- End If
- MyBase.BackColor = value
- If Parent IsNot Nothing Then
- If Not _ControlMode Then Parent.BackColor = value
- ColorHook()
- End If
- End Set
- End Property
- Overrides Property MinimumSize As Size
- Get
- Return MyBase.MinimumSize
- End Get
- Set(ByVal value As Size)
- MyBase.MinimumSize = value
- If Parent IsNot Nothing Then Parent.MinimumSize = value
- End Set
- End Property
- Overrides Property MaximumSize As Size
- Get
- Return MyBase.MaximumSize
- End Get
- Set(ByVal value As Size)
- MyBase.MaximumSize = value
- If Parent IsNot Nothing Then Parent.MaximumSize = value
- End Set
- End Property
- Overrides Property Text() As String
- Get
- Return MyBase.Text
- End Get
- Set(ByVal value As String)
- MyBase.Text = value
- Invalidate()
- End Set
- End Property
- Overrides Property Font() As Font
- Get
- Return MyBase.Font
- End Get
- Set(ByVal value As Font)
- MyBase.Font = value
- Invalidate()
- End Set
- End Property
- <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
- Overrides Property ForeColor() As Color
- Get
- Return Color.Empty
- End Get
- Set(ByVal value As Color)
- End Set
- End Property
- <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
- Overrides Property BackgroundImage() As Image
- Get
- Return Nothing
- End Get
- Set(ByVal value As Image)
- End Set
- End Property
- <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
- Overrides Property BackgroundImageLayout() As ImageLayout
- Get
- Return ImageLayout.None
- End Get
- Set(ByVal value As ImageLayout)
- End Set
- End Property
- #End Region
- #Region " Public Properties "
- Private _SmartBounds As Boolean = True
- Property SmartBounds() As Boolean
- Get
- Return _SmartBounds
- End Get
- Set(ByVal value As Boolean)
- _SmartBounds = value
- End Set
- End Property
- Private _Movable As Boolean = True
- Property Movable() As Boolean
- Get
- Return _Movable
- End Get
- Set(ByVal value As Boolean)
- _Movable = value
- End Set
- End Property
- Private _Sizable As Boolean = True
- Property Sizable() As Boolean
- Get
- Return _Sizable
- End Get
- Set(ByVal value As Boolean)
- _Sizable = value
- End Set
- End Property
- Private _TransparencyKey As Color
- Property TransparencyKey() As Color
- Get
- If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.TransparencyKey Else Return _TransparencyKey
- End Get
- Set(ByVal value As Color)
- If value = _TransparencyKey Then Return
- _TransparencyKey = value
- If _IsParentForm AndAlso Not _ControlMode Then
- ParentForm.TransparencyKey = value
- ColorHook()
- End If
- End Set
- End Property
- Private _BorderStyle As FormBorderStyle
- Property BorderStyle() As FormBorderStyle
- Get
- If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.FormBorderStyle Else Return _BorderStyle
- End Get
- Set(ByVal value As FormBorderStyle)
- _BorderStyle = value
- If _IsParentForm AndAlso Not _ControlMode Then
- ParentForm.FormBorderStyle = value
- If Not value = FormBorderStyle.None Then
- Movable = False
- Sizable = False
- End If
- End If
- End Set
- End Property
- Private _StartPosition As FormStartPosition
- Property StartPosition As FormStartPosition
- Get
- If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.StartPosition Else Return _StartPosition
- End Get
- Set(ByVal value As FormStartPosition)
- _StartPosition = value
- If _IsParentForm AndAlso Not _ControlMode Then
- ParentForm.StartPosition = value
- End If
- End Set
- End Property
- Private _NoRounding As Boolean
- Property NoRounding() As Boolean
- Get
- Return _NoRounding
- End Get
- Set(ByVal v As Boolean)
- _NoRounding = v
- Invalidate()
- End Set
- End Property
- Private _Image As Image
- Property Image() As Image
- Get
- Return _Image
- End Get
- Set(ByVal value As Image)
- If value Is Nothing Then _ImageSize = Size.Empty Else _ImageSize = value.Size
- _Image = value
- Invalidate()
- End Set
- End Property
- Private Items As New Dictionary(Of String, Color)
- Property Colors() As Bloom()
- Get
- Dim T As New List(Of Bloom)
- Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
- While E.MoveNext
- T.Add(New Bloom(E.Current.Key, E.Current.Value))
- End While
- Return T.ToArray
- End Get
- Set(ByVal value As Bloom())
- For Each B As Bloom In value
- If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
- Next
- InvalidateCustimization()
- ColorHook()
- Invalidate()
- End Set
- End Property
- Private _Customization As String
- Property Customization() As String
- Get
- Return _Customization
- End Get
- Set(ByVal value As String)
- If value = _Customization Then Return
- Dim Data As Byte()
- Dim Items As Bloom() = Colors
- Try
- Data = Convert.FromBase64String(value)
- For I As Integer = 0 To Items.Length - 1
- Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
- Next
- Catch
- Return
- End Try
- _Customization = value
- Colors = Items
- ColorHook()
- Invalidate()
- End Set
- End Property
- Private _Transparent As Boolean
- Property Transparent() As Boolean
- Get
- Return _Transparent
- End Get
- Set(ByVal value As Boolean)
- _Transparent = value
- If Not (IsHandleCreated OrElse _ControlMode) Then Return
- If Not value AndAlso Not BackColor.A = 255 Then
- Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
- End If
- SetStyle(ControlStyles.Opaque, Not value)
- SetStyle(ControlStyles.SupportsTransparentBackColor, value)
- InvalidateBitmap()
- Invalidate()
- End Set
- End Property
- #End Region
- #Region " Private Properties "
- Private _ImageSize As Size
- Protected ReadOnly Property ImageSize() As Size
- Get
- Return _ImageSize
- End Get
- End Property
- Private _IsParentForm As Boolean
- Protected ReadOnly Property IsParentForm As Boolean
- Get
- Return _IsParentForm
- End Get
- End Property
- Protected ReadOnly Property IsParentMdi As Boolean
- Get
- If Parent Is Nothing Then Return False
- Return Parent.Parent IsNot Nothing
- End Get
- End Property
- Private _LockWidth As Integer
- Protected Property LockWidth() As Integer
- Get
- Return _LockWidth
- End Get
- Set(ByVal value As Integer)
- _LockWidth = value
- If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
- End Set
- End Property
- Private _LockHeight As Integer
- Protected Property LockHeight() As Integer
- Get
- Return _LockHeight
- End Get
- Set(ByVal value As Integer)
- _LockHeight = value
- If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
- End Set
- End Property
- Private _Header As Integer = 24
- Protected Property Header() As Integer
- Get
- Return _Header
- End Get
- Set(ByVal v As Integer)
- _Header = v
- If Not _ControlMode Then
- Frame = New Rectangle(7, 7, Width - 14, v - 7)
- Invalidate()
- End If
- End Set
- End Property
- Private _ControlMode As Boolean
- Protected Property ControlMode() As Boolean
- Get
- Return _ControlMode
- End Get
- Set(ByVal v As Boolean)
- _ControlMode = v
- Transparent = _Transparent
- If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
- InvalidateBitmap()
- Invalidate()
- End Set
- End Property
- Private _IsAnimated As Boolean
- Protected Property IsAnimated() As Boolean
- Get
- Return _IsAnimated
- End Get
- Set(ByVal value As Boolean)
- _IsAnimated = value
- InvalidateTimer()
- End Set
- End Property
- #End Region
- #Region " Property Helpers "
- Protected Function GetPen(ByVal name As String) As Pen
- Return New Pen(Items(name))
- End Function
- Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
- Return New Pen(Items(name), width)
- End Function
- Protected Function GetBrush(ByVal name As String) As SolidBrush
- Return New SolidBrush(Items(name))
- End Function
- Protected Function GetColor(ByVal name As String) As Color
- Return Items(name)
- End Function
- Protected Sub SetColor(ByVal name As String, ByVal value As Color)
- If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
- End Sub
- Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
- SetColor(name, Color.FromArgb(r, g, b))
- End Sub
- Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
- SetColor(name, Color.FromArgb(a, r, g, b))
- End Sub
- Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
- SetColor(name, Color.FromArgb(a, value))
- End Sub
- Private Sub InvalidateBitmap()
- If _Transparent AndAlso _ControlMode Then
- If Width = 0 OrElse Height = 0 Then Return
- B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
- G = Graphics.FromImage(B)
- Else
- G = Nothing
- B = Nothing
- End If
- End Sub
- Private Sub InvalidateCustimization()
- Dim M As New MemoryStream(Items.Count * 4)
- For Each B As Bloom In Colors
- M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
- Next
- M.Close()
- _Customization = Convert.ToBase64String(M.ToArray)
- End Sub
- Private Sub InvalidateTimer()
- If DesignMode OrElse Not DoneCreation Then Return
- If _IsAnimated Then
- AddAnimationCallback(AddressOf DoAnimation)
- Else
- RemoveAnimationCallback(AddressOf DoAnimation)
- End If
- End Sub
- #End Region
- #Region " User Hooks "
- Protected MustOverride Sub ColorHook()
- Protected MustOverride Sub PaintHook()
- Protected Overridable Sub OnCreation()
- End Sub
- Protected Overridable Sub OnAnimation()
- End Sub
- #End Region
- #Region " Offset "
- Private OffsetReturnRectangle As Rectangle
- Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
- OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
- Return OffsetReturnRectangle
- End Function
- Private OffsetReturnSize As Size
- Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
- OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
- Return OffsetReturnSize
- End Function
- Private OffsetReturnPoint As Point
- Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
- OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
- Return OffsetReturnPoint
- End Function
- #End Region
- #Region " Center "
- Private CenterReturn As Point
- Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
- CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
- Return CenterReturn
- End Function
- Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
- CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
- Return CenterReturn
- End Function
- Protected Function Center(ByVal child As Rectangle) As Point
- Return Center(Width, Height, child.Width, child.Height)
- End Function
- Protected Function Center(ByVal child As Size) As Point
- Return Center(Width, Height, child.Width, child.Height)
- End Function
- Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
- Return Center(Width, Height, childWidth, childHeight)
- End Function
- Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
- Return Center(p.Width, p.Height, c.Width, c.Height)
- End Function
- Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
- CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
- Return CenterReturn
- End Function
- #End Region
- #Region " Measure "
- Private MeasureBitmap As Bitmap
- Private MeasureGraphics As Graphics
- Protected Function Measure() As Size
- SyncLock MeasureGraphics
- Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
- End SyncLock
- End Function
- Protected Function Measure(ByVal text As String) As Size
- SyncLock MeasureGraphics
- Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
- End SyncLock
- End Function
- #End Region
- #Region " DrawPixel "
- Private DrawPixelBrush As SolidBrush
- Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
- If _Transparent Then
- B.SetPixel(x, y, c1)
- Else
- DrawPixelBrush = New SolidBrush(c1)
- G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
- End If
- End Sub
- #End Region
- #Region " DrawCorners "
- Private DrawCornersBrush As SolidBrush
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
- DrawCorners(c1, 0, 0, Width, Height, offset)
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
- DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
- DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color)
- DrawCorners(c1, 0, 0, Width, Height)
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
- DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- If _NoRounding Then Return
- If _Transparent Then
- B.SetPixel(x, y, c1)
- B.SetPixel(x + (width - 1), y, c1)
- B.SetPixel(x, y + (height - 1), c1)
- B.SetPixel(x + (width - 1), y + (height - 1), c1)
- Else
- DrawCornersBrush = New SolidBrush(c1)
- G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
- G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
- G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
- G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
- End If
- End Sub
- #End Region
- #Region " DrawBorders "
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
- DrawBorders(p1, 0, 0, Width, Height, offset)
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
- DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
- DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen)
- DrawBorders(p1, 0, 0, Width, Height)
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
- DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- G.DrawRectangle(p1, x, y, width - 1, height - 1)
- End Sub
- #End Region
- #Region " DrawText "
- Private DrawTextPoint As Point
- Private DrawTextSize As Size
- Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
- DrawText(b1, Text, a, x, y)
- End Sub
- Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
- If text.Length = 0 Then Return
- DrawTextSize = Measure(text)
- DrawTextPoint = New Point(Width \ 2 - DrawTextSize.Width \ 2, Header \ 2 - DrawTextSize.Height \ 2)
- Select Case a
- Case HorizontalAlignment.Left
- G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
- Case HorizontalAlignment.Center
- G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
- Case HorizontalAlignment.Right
- G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
- End Select
- End Sub
- Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
- If Text.Length = 0 Then Return
- G.DrawString(Text, Font, b1, p1)
- End Sub
- Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
- If Text.Length = 0 Then Return
- G.DrawString(Text, Font, b1, x, y)
- End Sub
- #End Region
- #Region " DrawImage "
- Private DrawImagePoint As Point
- Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
- DrawImage(_Image, a, x, y)
- End Sub
- Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
- If image Is Nothing Then Return
- DrawImagePoint = New Point(Width \ 2 - image.Width \ 2, Header \ 2 - image.Height \ 2)
- Select Case a
- Case HorizontalAlignment.Left
- G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
- Case HorizontalAlignment.Center
- G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
- Case HorizontalAlignment.Right
- G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
- End Select
- End Sub
- Protected Sub DrawImage(ByVal p1 As Point)
- DrawImage(_Image, p1.X, p1.Y)
- End Sub
- Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
- DrawImage(_Image, x, y)
- End Sub
- Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
- DrawImage(image, p1.X, p1.Y)
- End Sub
- Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
- If image Is Nothing Then Return
- G.DrawImage(image, x, y, image.Width, image.Height)
- End Sub
- #End Region
- #Region " DrawGradient "
- Private DrawGradientBrush As LinearGradientBrush
- Private DrawGradientRectangle As Rectangle
- Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- DrawGradientRectangle = New Rectangle(x, y, width, height)
- DrawGradient(blend, DrawGradientRectangle)
- End Sub
- Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
- DrawGradientRectangle = New Rectangle(x, y, width, height)
- DrawGradient(blend, DrawGradientRectangle, angle)
- End Sub
- Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
- DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
- DrawGradientBrush.InterpolationColors = blend
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
- DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
- DrawGradientBrush.InterpolationColors = blend
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- DrawGradientRectangle = New Rectangle(x, y, width, height)
- DrawGradient(c1, c2, DrawGradientRectangle)
- End Sub
- Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
- DrawGradientRectangle = New Rectangle(x, y, width, height)
- DrawGradient(c1, c2, DrawGradientRectangle, angle)
- End Sub
- Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
- DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
- DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- #End Region
- #Region " DrawRadial "
- Private DrawRadialPath As GraphicsPath
- Private DrawRadialBrush1 As PathGradientBrush
- Private DrawRadialBrush2 As LinearGradientBrush
- Private DrawRadialRectangle As Rectangle
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal center As Point)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cx As Integer, ByVal cy As Integer)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(blend, DrawRadialRectangle, cx, cy)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
- DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
- DrawRadial(blend, r, center.X, center.Y)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
- DrawRadialPath.Reset()
- DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
- DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
- DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
- DrawRadialBrush1.InterpolationColors = blend
- If G.SmoothingMode = SmoothingMode.AntiAlias Then
- G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
- Else
- G.FillEllipse(DrawRadialBrush1, r)
- End If
- End Sub
- Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(c1, c2, DrawGradientRectangle)
- End Sub
- Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(c1, c2, DrawGradientRectangle, angle)
- End Sub
- Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
- DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
- DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
- G.FillEllipse(DrawGradientBrush, r)
- End Sub
- #End Region
- #Region " CreateRound "
- Private CreateRoundPath As GraphicsPath
- Private CreateRoundRectangle As Rectangle
- Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
- CreateRoundRectangle = New Rectangle(x, y, width, height)
- Return CreateRound(CreateRoundRectangle, slope)
- End Function
- Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
- CreateRoundPath = New GraphicsPath(FillMode.Winding)
- CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
- CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
- CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
- CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
- CreateRoundPath.CloseFigure()
- Return CreateRoundPath
- End Function
- #End Region
- End Class
- MustInherit Class ThemeControl154
- Inherits Control
- #Region " Initialization "
- Protected G As Graphics, B As Bitmap
- Sub New()
- SetStyle(DirectCast(139270, ControlStyles), True)
- _ImageSize = Size.Empty
- Font = New Font("Verdana", 8S)
- MeasureBitmap = New Bitmap(1, 1)
- MeasureGraphics = Graphics.FromImage(MeasureBitmap)
- DrawRadialPath = New GraphicsPath
- InvalidateCustimization() 'Remove?
- End Sub
- Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
- InvalidateCustimization()
- ColorHook()
- If Not _LockWidth = 0 Then Width = _LockWidth
- If Not _LockHeight = 0 Then Height = _LockHeight
- Transparent = _Transparent
- If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
- MyBase.OnHandleCreated(e)
- End Sub
- Private DoneCreation As Boolean
- Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
- If Parent IsNot Nothing Then
- OnCreation()
- DoneCreation = True
- InvalidateTimer()
- End If
- MyBase.OnParentChanged(e)
- End Sub
- #End Region
- Private Sub DoAnimation(ByVal i As Boolean)
- OnAnimation()
- If i Then Invalidate()
- End Sub
- Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
- If Width = 0 OrElse Height = 0 Then Return
- If _Transparent Then
- PaintHook()
- e.Graphics.DrawImage(B, 0, 0)
- Else
- G = e.Graphics
- PaintHook()
- End If
- End Sub
- Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
- RemoveAnimationCallback(AddressOf DoAnimation)
- MyBase.OnHandleDestroyed(e)
- End Sub
- #Region " Size Handling "
- Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
- If _Transparent Then
- InvalidateBitmap()
- End If
- Invalidate()
- MyBase.OnSizeChanged(e)
- End Sub
- Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
- If Not _LockWidth = 0 Then width = _LockWidth
- If Not _LockHeight = 0 Then height = _LockHeight
- MyBase.SetBoundsCore(x, y, width, height, specified)
- End Sub
- #End Region
- #Region " State Handling "
- Private InPosition As Boolean
- Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
- InPosition = True
- SetState(MouseState.Over)
- MyBase.OnMouseEnter(e)
- End Sub
- Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
- If InPosition Then SetState(MouseState.Over)
- MyBase.OnMouseUp(e)
- End Sub
- Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
- If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
- MyBase.OnMouseDown(e)
- End Sub
- Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
- InPosition = False
- SetState(MouseState.None)
- MyBase.OnMouseLeave(e)
- End Sub
- Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
- If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
- MyBase.OnEnabledChanged(e)
- End Sub
- Protected State As MouseState
- Private Sub SetState(ByVal current As MouseState)
- State = current
- Invalidate()
- End Sub
- #End Region
- #Region " Base Properties "
- <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
- Overrides Property ForeColor() As Color
- Get
- Return Color.Empty
- End Get
- Set(ByVal value As Color)
- End Set
- End Property
- <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
- Overrides Property BackgroundImage() As Image
- Get
- Return Nothing
- End Get
- Set(ByVal value As Image)
- End Set
- End Property
- <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
- Overrides Property BackgroundImageLayout() As ImageLayout
- Get
- Return ImageLayout.None
- End Get
- Set(ByVal value As ImageLayout)
- End Set
- End Property
- Overrides Property Text() As String
- Get
- Return MyBase.Text
- End Get
- Set(ByVal value As String)
- MyBase.Text = value
- Invalidate()
- End Set
- End Property
- Overrides Property Font() As Font
- Get
- Return MyBase.Font
- End Get
- Set(ByVal value As Font)
- MyBase.Font = value
- Invalidate()
- End Set
- End Property
- Private _BackColor As Boolean
- <Category("Misc")> _
- Overrides Property BackColor() As Color
- Get
- Return MyBase.BackColor
- End Get
- Set(ByVal value As Color)
- If Not IsHandleCreated AndAlso value = Color.Transparent Then
- _BackColor = True
- Return
- End If
- MyBase.BackColor = value
- If Parent IsNot Nothing Then ColorHook()
- End Set
- End Property
- #End Region
- #Region " Public Properties "
- Private _NoRounding As Boolean
- Property NoRounding() As Boolean
- Get
- Return _NoRounding
- End Get
- Set(ByVal v As Boolean)
- _NoRounding = v
- Invalidate()
- End Set
- End Property
- Private _Image As Image
- Property Image() As Image
- Get
- Return _Image
- End Get
- Set(ByVal value As Image)
- If value Is Nothing Then
- _ImageSize = Size.Empty
- Else
- _ImageSize = value.Size
- End If
- _Image = value
- Invalidate()
- End Set
- End Property
- Private _Transparent As Boolean
- Property Transparent() As Boolean
- Get
- Return _Transparent
- End Get
- Set(ByVal value As Boolean)
- _Transparent = value
- If Not IsHandleCreated Then Return
- If Not value AndAlso Not BackColor.A = 255 Then
- Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
- End If
- SetStyle(ControlStyles.Opaque, Not value)
- SetStyle(ControlStyles.SupportsTransparentBackColor, value)
- If value Then InvalidateBitmap() Else B = Nothing
- Invalidate()
- End Set
- End Property
- Private Items As New Dictionary(Of String, Color)
- Property Colors() As Bloom()
- Get
- Dim T As New List(Of Bloom)
- Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
- While E.MoveNext
- T.Add(New Bloom(E.Current.Key, E.Current.Value))
- End While
- Return T.ToArray
- End Get
- Set(ByVal value As Bloom())
- For Each B As Bloom In value
- If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
- Next
- InvalidateCustimization()
- ColorHook()
- Invalidate()
- End Set
- End Property
- Private _Customization As String
- Property Customization() As String
- Get
- Return _Customization
- End Get
- Set(ByVal value As String)
- If value = _Customization Then Return
- Dim Data As Byte()
- Dim Items As Bloom() = Colors
- Try
- Data = Convert.FromBase64String(value)
- For I As Integer = 0 To Items.Length - 1
- Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
- Next
- Catch
- Return
- End Try
- _Customization = value
- Colors = Items
- ColorHook()
- Invalidate()
- End Set
- End Property
- #End Region
- #Region " Private Properties "
- Private _ImageSize As Size
- Protected ReadOnly Property ImageSize() As Size
- Get
- Return _ImageSize
- End Get
- End Property
- Private _LockWidth As Integer
- Protected Property LockWidth() As Integer
- Get
- Return _LockWidth
- End Get
- Set(ByVal value As Integer)
- _LockWidth = value
- If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
- End Set
- End Property
- Private _LockHeight As Integer
- Protected Property LockHeight() As Integer
- Get
- Return _LockHeight
- End Get
- Set(ByVal value As Integer)
- _LockHeight = value
- If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
- End Set
- End Property
- Private _IsAnimated As Boolean
- Protected Property IsAnimated() As Boolean
- Get
- Return _IsAnimated
- End Get
- Set(ByVal value As Boolean)
- _IsAnimated = value
- InvalidateTimer()
- End Set
- End Property
- #End Region
- #Region " Property Helpers "
- Protected Function GetPen(ByVal name As String) As Pen
- Return New Pen(Items(name))
- End Function
- Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
- Return New Pen(Items(name), width)
- End Function
- Protected Function GetBrush(ByVal name As String) As SolidBrush
- Return New SolidBrush(Items(name))
- End Function
- Protected Function GetColor(ByVal name As String) As Color
- Return Items(name)
- End Function
- Protected Sub SetColor(ByVal name As String, ByVal value As Color)
- If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
- End Sub
- Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
- SetColor(name, Color.FromArgb(r, g, b))
- End Sub
- Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
- SetColor(name, Color.FromArgb(a, r, g, b))
- End Sub
- Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
- SetColor(name, Color.FromArgb(a, value))
- End Sub
- Private Sub InvalidateBitmap()
- If Width = 0 OrElse Height = 0 Then Return
- B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
- G = Graphics.FromImage(B)
- End Sub
- Private Sub InvalidateCustimization()
- Dim M As New MemoryStream(Items.Count * 4)
- For Each B As Bloom In Colors
- M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
- Next
- M.Close()
- _Customization = Convert.ToBase64String(M.ToArray)
- End Sub
- Private Sub InvalidateTimer()
- If DesignMode OrElse Not DoneCreation Then Return
- If _IsAnimated Then
- AddAnimationCallback(AddressOf DoAnimation)
- Else
- RemoveAnimationCallback(AddressOf DoAnimation)
- End If
- End Sub
- #End Region
- #Region " User Hooks "
- Protected MustOverride Sub ColorHook()
- Protected MustOverride Sub PaintHook()
- Protected Overridable Sub OnCreation()
- End Sub
- Protected Overridable Sub OnAnimation()
- End Sub
- #End Region
- #Region " Offset "
- Private OffsetReturnRectangle As Rectangle
- Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
- OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
- Return OffsetReturnRectangle
- End Function
- Private OffsetReturnSize As Size
- Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
- OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
- Return OffsetReturnSize
- End Function
- Private OffsetReturnPoint As Point
- Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
- OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
- Return OffsetReturnPoint
- End Function
- #End Region
- #Region " Center "
- Private CenterReturn As Point
- Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
- CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
- Return CenterReturn
- End Function
- Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
- CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
- Return CenterReturn
- End Function
- Protected Function Center(ByVal child As Rectangle) As Point
- Return Center(Width, Height, child.Width, child.Height)
- End Function
- Protected Function Center(ByVal child As Size) As Point
- Return Center(Width, Height, child.Width, child.Height)
- End Function
- Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
- Return Center(Width, Height, childWidth, childHeight)
- End Function
- Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
- Return Center(p.Width, p.Height, c.Width, c.Height)
- End Function
- Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
- CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
- Return CenterReturn
- End Function
- #End Region
- #Region " Measure "
- Private MeasureBitmap As Bitmap
- Private MeasureGraphics As Graphics 'TODO: Potential issues during multi-threading.
- Protected Function Measure() As Size
- Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
- End Function
- Protected Function Measure(ByVal text As String) As Size
- Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
- End Function
- #End Region
- #Region " DrawPixel "
- Private DrawPixelBrush As SolidBrush
- Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
- If _Transparent Then
- B.SetPixel(x, y, c1)
- Else
- DrawPixelBrush = New SolidBrush(c1)
- G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
- End If
- End Sub
- #End Region
- #Region " DrawCorners "
- Private DrawCornersBrush As SolidBrush
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
- DrawCorners(c1, 0, 0, Width, Height, offset)
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
- DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
- DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color)
- DrawCorners(c1, 0, 0, Width, Height)
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
- DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
- End Sub
- Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- If _NoRounding Then Return
- If _Transparent Then
- B.SetPixel(x, y, c1)
- B.SetPixel(x + (width - 1), y, c1)
- B.SetPixel(x, y + (height - 1), c1)
- B.SetPixel(x + (width - 1), y + (height - 1), c1)
- Else
- DrawCornersBrush = New SolidBrush(c1)
- G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
- G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
- G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
- G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
- End If
- End Sub
- #End Region
- #Region " DrawBorders "
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
- DrawBorders(p1, 0, 0, Width, Height, offset)
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
- DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
- DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen)
- DrawBorders(p1, 0, 0, Width, Height)
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
- DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
- End Sub
- Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- G.DrawRectangle(p1, x, y, width - 1, height - 1)
- End Sub
- #End Region
- #Region " DrawText "
- Private DrawTextPoint As Point
- Private DrawTextSize As Size
- Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
- DrawText(b1, Text, a, x, y)
- End Sub
- Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
- If text.Length = 0 Then Return
- DrawTextSize = Measure(text)
- DrawTextPoint = Center(DrawTextSize)
- Select Case a
- Case HorizontalAlignment.Left
- G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
- Case HorizontalAlignment.Center
- G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
- Case HorizontalAlignment.Right
- G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
- End Select
- End Sub
- Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
- If Text.Length = 0 Then Return
- G.DrawString(Text, Font, b1, p1)
- End Sub
- Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
- If Text.Length = 0 Then Return
- G.DrawString(Text, Font, b1, x, y)
- End Sub
- #End Region
- #Region " DrawImage "
- Private DrawImagePoint As Point
- Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
- DrawImage(_Image, a, x, y)
- End Sub
- Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
- If image Is Nothing Then Return
- DrawImagePoint = Center(image.Size)
- Select Case a
- Case HorizontalAlignment.Left
- G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
- Case HorizontalAlignment.Center
- G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
- Case HorizontalAlignment.Right
- G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
- End Select
- End Sub
- Protected Sub DrawImage(ByVal p1 As Point)
- DrawImage(_Image, p1.X, p1.Y)
- End Sub
- Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
- DrawImage(_Image, x, y)
- End Sub
- Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
- DrawImage(image, p1.X, p1.Y)
- End Sub
- Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
- If image Is Nothing Then Return
- G.DrawImage(image, x, y, image.Width, image.Height)
- End Sub
- #End Region
- #Region " DrawGradient "
- Private DrawGradientBrush As LinearGradientBrush
- Private DrawGradientRectangle As Rectangle
- Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- DrawGradientRectangle = New Rectangle(x, y, width, height)
- DrawGradient(blend, DrawGradientRectangle)
- End Sub
- Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
- DrawGradientRectangle = New Rectangle(x, y, width, height)
- DrawGradient(blend, DrawGradientRectangle, angle)
- End Sub
- Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
- DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
- DrawGradientBrush.InterpolationColors = blend
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
- DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
- DrawGradientBrush.InterpolationColors = blend
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- DrawGradientRectangle = New Rectangle(x, y, width, height)
- DrawGradient(c1, c2, DrawGradientRectangle)
- End Sub
- Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
- DrawGradientRectangle = New Rectangle(x, y, width, height)
- DrawGradient(c1, c2, DrawGradientRectangle, angle)
- End Sub
- Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
- DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
- DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
- G.FillRectangle(DrawGradientBrush, r)
- End Sub
- #End Region
- #Region " DrawRadial "
- Private DrawRadialPath As GraphicsPath
- Private DrawRadialBrush1 As PathGradientBrush
- Private DrawRadialBrush2 As LinearGradientBrush
- Private DrawRadialRectangle As Rectangle
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal center As Point)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cx As Integer, ByVal cy As Integer)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(blend, DrawRadialRectangle, cx, cy)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
- DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
- DrawRadial(blend, r, center.X, center.Y)
- End Sub
- Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
- DrawRadialPath.Reset()
- DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
- DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
- DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
- DrawRadialBrush1.InterpolationColors = blend
- If G.SmoothingMode = SmoothingMode.AntiAlias Then
- G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
- Else
- G.FillEllipse(DrawRadialBrush1, r)
- End If
- End Sub
- Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(c1, c2, DrawRadialRectangle)
- End Sub
- Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
- DrawRadialRectangle = New Rectangle(x, y, width, height)
- DrawRadial(c1, c2, DrawRadialRectangle, angle)
- End Sub
- Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
- DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
- G.FillEllipse(DrawRadialBrush2, r)
- End Sub
- Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
- DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
- G.FillEllipse(DrawRadialBrush2, r)
- End Sub
- #End Region
- #Region " CreateRound "
- Private CreateRoundPath As GraphicsPath
- Private CreateRoundRectangle As Rectangle
- Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
- CreateRoundRectangle = New Rectangle(x, y, width, height)
- Return CreateRound(CreateRoundRectangle, slope)
- End Function
- Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
- CreateRoundPath = New GraphicsPath(FillMode.Winding)
- CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
- CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
- CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
- CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
- CreateRoundPath.CloseFigure()
- Return CreateRoundPath
- End Function
- #End Region
- End Class
- Module ThemeShare
- #Region " Animation "
- Private Frames As Integer
- Private Invalidate As Boolean
- Public ThemeTimer As New PrecisionTimer
- Private Const FPS As Integer = 50 '1000 / 50 = 20 FPS
- Private Const Rate As Integer = 10
- Public Delegate Sub AnimationDelegate(ByVal invalidate As Boolean)
- Private Callbacks As New List(Of AnimationDelegate)
- Private Sub HandleCallbacks(ByVal state As IntPtr, ByVal reserve As Boolean)
- Invalidate = (Frames >= FPS)
- If Invalidate Then Frames = 0
- SyncLock Callbacks
- For I As Integer = 0 To Callbacks.Count - 1
- Callbacks(I).Invoke(Invalidate)
- Next
- End SyncLock
- Frames += Rate
- End Sub
- Private Sub InvalidateThemeTimer()
- If Callbacks.Count = 0 Then
- ThemeTimer.Delete()
- Else
- ThemeTimer.Create(0, Rate, AddressOf HandleCallbacks)
- End If
- End Sub
- Sub AddAnimationCallback(ByVal callback As AnimationDelegate)
- SyncLock Callbacks
- If Callbacks.Contains(callback) Then Return
- Callbacks.Add(callback)
- InvalidateThemeTimer()
- End SyncLock
- End Sub
- Sub RemoveAnimationCallback(ByVal callback As AnimationDelegate)
- SyncLock Callbacks
- If Not Callbacks.Contains(callback) Then Return
- Callbacks.Remove(callback)
- InvalidateThemeTimer()
- End SyncLock
- End Sub
- #End Region
- End Module
- Enum MouseState As Byte
- None = 0
- Over = 1
- Down = 2
- Block = 3
- End Enum
- Structure Bloom
- Public _Name As String
- ReadOnly Property Name() As String
- Get
- Return _Name
- End Get
- End Property
- Private _Value As Color
- Property Value() As Color
- Get
- Return _Value
- End Get
- Set(ByVal value As Color)
- _Value = value
- End Set
- End Property
- Property ValueHex() As String
- Get
- Return String.Concat("#", _
- _Value.R.ToString("X2", Nothing), _
- _Value.G.ToString("X2", Nothing), _
- _Value.B.ToString("X2", Nothing))
- End Get
- Set(ByVal value As String)
- Try
- _Value = ColorTranslator.FromHtml(value)
- Catch
- Return
- End Try
- End Set
- End Property
- Sub New(ByVal name As String, ByVal value As Color)
- _Name = name
- _Value = value
- End Sub
- End Structure
- '------------------
- 'Creator: aeonhack
- 'Site: elitevs.net
- 'Created: 11/30/2011
- 'Changed: 11/30/2011
- 'Version: 1.0.0
- '------------------
- Class PrecisionTimer
- Implements IDisposable
- Private _Enabled As Boolean
- ReadOnly Property Enabled() As Boolean
- Get
- Return _Enabled
- End Get
- End Property
- Private Handle As IntPtr
- Private TimerCallback As TimerDelegate
- <DllImport("kernel32.dll", EntryPoint:="CreateTimerQueueTimer")> _
- Private Shared Function CreateTimerQueueTimer( _
- ByRef handle As IntPtr, _
- ByVal queue As IntPtr, _
- ByVal callback As TimerDelegate, _
- ByVal state As IntPtr, _
- ByVal dueTime As UInteger, _
- ByVal period As UInteger, _
- ByVal flags As UInteger) As Boolean
- End Function
- <DllImport("kernel32.dll", EntryPoint:="DeleteTimerQueueTimer")> _
- Private Shared Function DeleteTimerQueueTimer( _
- ByVal queue As IntPtr, _
- ByVal handle As IntPtr, _
- ByVal callback As IntPtr) As Boolean
- End Function
- Delegate Sub TimerDelegate(ByVal r1 As IntPtr, ByVal r2 As Boolean)
- Sub Create(ByVal dueTime As UInteger, ByVal period As UInteger, ByVal callback As TimerDelegate)
- If _Enabled Then Return
- TimerCallback = callback
- Dim Success As Boolean = CreateTimerQueueTimer(Handle, IntPtr.Zero, TimerCallback, IntPtr.Zero, dueTime, period, 0)
- If Not Success Then ThrowNewException("CreateTimerQueueTimer")
- _Enabled = Success
- End Sub
- Sub Delete()
- If Not _Enabled Then Return
- Dim Success As Boolean = DeleteTimerQueueTimer(IntPtr.Zero, Handle, IntPtr.Zero)
- If Not Success AndAlso Not Marshal.GetLastWin32Error = 997 Then
- ThrowNewException("DeleteTimerQueueTimer")
- End If
- _Enabled = Not Success
- End Sub
- Private Sub ThrowNewException(ByVal name As String)
- Throw New Exception(String.Format("{0} failed. Win32Error: {1}", name, Marshal.GetLastWin32Error))
- End Sub
- Public Sub Dispose() Implements IDisposable.Dispose
- Delete()
- End Sub
- End Class
- #End Region
- ' ------------------
- ' Creator: The Elite Noob
- ' Created: 3-12-11
- ' Version: 2.0.0
- ' ThemeBase: 1.5.4 (by Aeonhack)
- '------------------
- Class eliteTheme
- Inherits ThemeContainer154
- Public Sub New()
- MyBase.New()
- BackColor = Color.FromArgb(42, 42, 42)
- ' Background Color
- TransparencyKey = Color.Purple
- ' The Color used for Transparent
- SetColor("Background", 42, 42, 42)
- ' Background Color
- SetColor("DarkGradient", 32, 32, 32)
- ' Used to Make a Gradient
- SetColor("BackgroundGradient", 42, 42, 42)
- ' Used to make a Gradient
- SetColor("Line1", 42, 42, 42)
- ' First Line Color
- SetColor("Line2", 28, 28, 28)
- ' Second Line Color
- SetColor("Text", 254, 254, 254)
- ' Text Color
- SetColor("Border1", 43, 43, 43)
- ' First Border
- SetColor("Border2", 25, 25, 25)
- ' Second Borders
- End Sub
- ' Declare some Variables
- ' The Letter is Variable type, while the number is what color it is
- Private C1 As Color
- Private C2 As Color
- Private C3 As Color
- Private P1 As Pen
- Private P2 As Pen
- Private P3 As Pen
- Private P4 As Pen
- Private B1 As SolidBrush
- Protected Overrides Sub ColorHook()
- ' Function by Aeonhack
- C1 = GetColor("Background")
- ' Get the Background Color
- C2 = GetColor("DarkGradient")
- ' Get the Dark Gradient
- C3 = GetColor("BackgroundGradient")
- ' The Light Gradient
- P1 = New Pen(GetColor("Line1"))
- ' Create a Pen for the Line
- P2 = New Pen(GetColor("Line2"))
- P3 = New Pen(GetColor("Border1"))
- ' Create a Pen for the Border
- P4 = New Pen(GetColor("Border2"))
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up a brush for the Text
- BackColor = C1
- ' Create a Second Variable for The Background Color
- End Sub
- Protected Overrides Sub PaintHook()
- ' Actually Create the Form, by Aeonhack
- G.Clear(C1)
- ' Clear the Form with the Basic Color
- DrawGradient(C3, C2, 0, 0, Width, 25)
- ' Draw the Background Gradient
- G.DrawLine(P1, 0, 25, Width, 25)
- ' Draw the Separtor for the Bar
- G.DrawLine(P2, 0, 25, Width, 25)
- DrawText(B1, HorizontalAlignment.Left, 5, 0)
- ' Draw the Title Text
- DrawBorders(P3, 1)
- ' Creating the Inner Border
- DrawBorders(P4)
- ' Create the Outer Border
- DrawCorners(TransparencyKey)
- ' Create a Corner with the Transparent Key
- End Sub
- End Class
- ' All Code from Here on is 100% Orignial and by The Elite Noob @ Hackforums
- Class eliteButton
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 42, 42, 42)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 50, 50, 50)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("NoneGradient1", 50, 50, 50)
- SetColor("NoneGradient2", 42, 42, 42)
- SetColor("ClickedGradient1", 47, 47, 47)
- SetColor("ClickedGradient2", 39, 39, 39)
- SetColor("Text", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- ' Basic Function by Aeonhack
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- ' Basic Function by Aeonhack
- If (State = MouseState.Over) Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is hovered over
- ElseIf (State = MouseState.Down) Then
- DrawGradient(C6, C5, ClientRectangle, 90.0!)
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0!)
- ' else change the shading
- End If
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- Class eliteLabel
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- ' Create a Label
- SetColor("Text", 254, 254, 254)
- ' Text Color for Label
- SetColor("Background", 42, 42, 42)
- ' Background Color
- End Sub
- Private C1 As Color
- ' used for the Basic Background of the Label
- Private B1 As SolidBrush
- ' The Main Color of the Text, Is painted on with a brush
- Protected Overrides Sub ColorHook()
- ' Assigning the colors to variables
- C1 = GetColor("Background")
- ' Get the Background Color
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- End Sub
- Protected Overrides Sub PaintHook()
- G.Clear(C1)
- ' Clear the Color of Background
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Align Text In Center of Label
- End Sub
- End Class
- Class eliteBorderLabel
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 42, 42, 42)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 42, 42, 42)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("Text", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- ' Assign Variables
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- ' Draw Custom Label
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is pressed
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- Class eliteHide
- Inherits ThemeControl154
- Public Property WindowState As FormWindowState
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 140, 138, 27)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 180, 196, 114)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("NoneGradient1", 50, 50, 50)
- SetColor("NoneGradient2", 42, 42, 42)
- SetColor("ClickedGradient1", 204, 201, 35)
- SetColor("ClickedGradient2", 140, 138, 27)
- SetColor("Text", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- If (Me.State = MouseState.Over) Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is hovered over
- Me.Text = "_"
- ElseIf (Me.State = MouseState.Down) Then
- DrawGradient(C6, C5, ClientRectangle, 90.0!)
- Me.Text = "_"
- Application.OpenForms(0).WindowState = FormWindowState.Minimized
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0!)
- ' else change the shading
- End If
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- Class eliteHideSecond
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 140, 138, 27)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 180, 196, 114)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("NoneGradient1", 50, 50, 50)
- SetColor("NoneGradient2", 42, 42, 42)
- SetColor("ClickedGradient1", 204, 201, 35)
- SetColor("ClickedGradient2", 140, 138, 27)
- SetColor("Text", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- If (Me.State = MouseState.Over) Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is hovered over
- Me.Text = "_"
- ElseIf (Me.State = MouseState.Down) Then
- DrawGradient(C6, C5, ClientRectangle, 90.0!)
- Me.Text = "_"
- Application.OpenForms(1).WindowState = FormWindowState.Minimized
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0!)
- ' else change the shading
- End If
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- Class eliteQuestion
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 140, 138, 27)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 180, 196, 114)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("NoneGradient1", 50, 50, 50)
- SetColor("NoneGradient2", 42, 42, 42)
- SetColor("ClickedGradient1", 204, 201, 35)
- SetColor("ClickedGradient2", 140, 138, 27)
- SetColor("Text", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- If (Me.State = MouseState.Over) Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is hovered over
- Me.Text = "?"
- ElseIf (Me.State = MouseState.Down) Then
- DrawGradient(C6, C5, ClientRectangle, 90.0!)
- Me.Text = "?"
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0!)
- ' else change the shading
- End If
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- Class eliteClose
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 210, 15, 13)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 243, 97, 24)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("NoneGradient1", 50, 50, 50)
- SetColor("NoneGradient2", 42, 42, 42)
- SetColor("ClickedGradient1", 247, 127, 30)
- SetColor("ClickedGradient2", 210, 15, 13)
- SetColor("Text", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- If (Me.State = MouseState.Over) Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is hovered over
- Me.Text = "x"
- ElseIf (Me.State = MouseState.Down) Then
- DrawGradient(C6, C5, ClientRectangle, 90.0!)
- Me.Text = "x"
- Application.Exit()
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0!)
- ' else change the shading
- End If
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- Class eliteCloseSecond
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 210, 15, 13)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 243, 97, 24)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("NoneGradient1", 50, 50, 50)
- SetColor("NoneGradient2", 42, 42, 42)
- SetColor("ClickedGradient1", 247, 127, 30)
- SetColor("ClickedGradient2", 210, 15, 13)
- SetColor("Text", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- If (Me.State = MouseState.Over) Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is hovered over
- Me.Text = "x"
- ElseIf (Me.State = MouseState.Down) Then
- DrawGradient(C6, C5, ClientRectangle, 90.0!)
- Me.Text = "x"
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0!)
- ' else change the shading
- End If
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- Class eliteMaximize
- Inherits ThemeControl154
- Public Property WindowState As FormWindowState
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 140, 138, 27)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 180, 196, 114)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("NoneGradient1", 50, 50, 50)
- SetColor("NoneGradient2", 42, 42, 42)
- SetColor("ClickedGradient1", 204, 201, 35)
- SetColor("ClickedGradient2", 140, 138, 27)
- SetColor("Text", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- If (Me.State = MouseState.Over) Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is hovered over
- If (Application.OpenForms(0).WindowState = FormWindowState.Normal) Then
- Me.Text = "+"
- ElseIf (Application.OpenForms(0).WindowState = FormWindowState.Maximized) Then
- Me.Text = "-"
- End If
- ElseIf (Me.State = MouseState.Down) Then
- DrawGradient(C6, C5, ClientRectangle, 90.0!)
- If (Application.OpenForms(0).WindowState = FormWindowState.Normal) Then
- Me.Text = "+"
- System.Threading.Thread.Sleep(100)
- Application.OpenForms(0).WindowState = FormWindowState.Maximized
- Me.Text = "-"
- ElseIf (Application.OpenForms(0).WindowState = FormWindowState.Maximized) Then
- Me.Text = "-"
- System.Threading.Thread.Sleep(100)
- Application.OpenForms(0).WindowState = FormWindowState.Normal
- Me.Text = "+"
- End If
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0!)
- ' else change the shading
- End If
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- Class eliteSeparatorHorizontal
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 42, 42, 42)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 42, 42, 42)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- ' Assign Variables
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- ' Draw Custom Label
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is pressed
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
- ' EDIT: ADD AN EXTRA HEIGHT VALIDATION TO AVOID INITIALIZATION PROBLEMS
- ' BITWISE 'AND' OPERATION: IF ZERO THEN HEIGHT IS NOT INVOLVED IN THIS OPERATION
- If (((specified And BoundsSpecified.Height) _
- = 0) _
- OrElse (height = 4)) Then
- MyBase.SetBoundsCore(x, y, width, 4, specified)
- Else
- Return
- ' RETURN WITHOUT DOING ANY RESIZING
- End If
- End Sub
- End Class
- Class eliteSeparatorVertical
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- SetColor("DownGradient1", 42, 42, 42)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 42, 42, 42)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("Border1", 35, 35, 35)
- ' The Inside Border
- SetColor("Border2", 42, 42, 42)
- ' The Outside Border
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- ' Assign Variables
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- ' Draw Custom Label
- DrawGradient(C1, C2, ClientRectangle, 90.0!)
- ' if button is pressed
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
- ' EDIT: ADD AN EXTRA HEIGHT VALIDATION TO AVOID INITIALIZATION PROBLEMS
- ' BITWISE 'AND' OPERATION: IF ZERO THEN HEIGHT IS NOT INVOLVED IN THIS OPERATION
- If (((specified And BoundsSpecified.Width) _
- = 0) _
- OrElse (width = 4)) Then
- MyBase.SetBoundsCore(x, y, 4, height, specified)
- Else
- Return
- ' RETURN WITHOUT DOING ANY RESIZING
- End If
- End Sub
- End Class
- 'This is used to see if it is a checkbox and so on.
- <DefaultEvent("CheckedChanged")> _
- Class eliteCheckBox
- Inherits ThemeControl154
- Public Sub New()
- MyBase.New()
- Transparent = True
- ' it is infact transpernt
- BackColor = Color.Transparent
- ' no lockheight since that way they can choose how they want it.
- ' no text since i want the user to choose wether or not they want check, also, that way the border doesn't go around it.
- SetColor("Background", 249, 249, 249)
- ' Background is Dark
- SetColor("ClickedGradient1", 204, 201, 35)
- ' the green graident on the inside.
- SetColor("ClickedGradient2", 140, 138, 27)
- SetColor("Border1", 235, 235, 235)
- ' The Inside Border
- SetColor("Border2", 249, 249, 249)
- ' The Outside Border
- End Sub
- ' set up the variables
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C1 = GetColor("Background")
- ' Get the Colors for the Button Shading
- C2 = GetColor("ClickedGradient1")
- C3 = GetColor("ClickedGradient2")
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- G.Clear(BackColor)
- Select Case (_Checked)
- Case True
- 'Put your checked state here
- DrawGradient(C1, C1, ClientRectangle, 90.0!)
- ' checked background
- DrawGradient(C2, C3, 3, 3, (Me.Width - 6), (Me.Height - 6), 90.0!)
- ' checked background
- DrawBorders(P1, 1)
- ' Create the Inner Border
- Me.Height = Me.Width
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- Case False
- 'Put your unchecked state here
- DrawGradient(C1, C1, ClientRectangle, 90.0!)
- ' unchecked background
- DrawBorders(P1, 1)
- ' Create the Inner Border
- Me.Height = Me.Width
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Select
- End Sub
- Private Property _Checked As Boolean
- Public Property Checked As Boolean
- Get
- Return _Checked
- End Get
- Set(value As Boolean)
- _Checked = value
- End Set
- End Property
- Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
- _Checked = Not _Checked
- RaiseEvent CheckedChanged(Me)
- MyBase.OnClick(e)
- End Sub
- Public Event CheckedChanged As CheckedChangedEventHandler
- Public Delegate Sub CheckedChangedEventHandler(ByVal sender As Object)
- End Class
- Class elitePanelBacking
- Inherits UserControl
- Private panelMain As Panel
- Public Sub New()
- MyBase.New()
- InitializeComponent()
- End Sub
- Private Sub InitializeComponent()
- Me.panelMain = New System.Windows.Forms.Panel
- Me.SuspendLayout()
- Dim Background As Color = Color.FromArgb(249, 249, 249)
- '
- ' panelMain
- '
- Me.panelMain.BackColor = Background
- Me.panelMain.Dock = System.Windows.Forms.DockStyle.Fill
- Me.panelMain.Location = New System.Drawing.Point(0, 0)
- Me.panelMain.Name = "elitePanelMainBacking"
- Me.panelMain.Size = New System.Drawing.Size(150, 150)
- Me.panelMain.TabIndex = 0
- '
- ' myPanel
- '
- Me.Controls.Add(Me.panelMain)
- Me.Name = "elitePanelBacking"
- Me.ResumeLayout(False)
- End Sub
- End Class
- Public Class eliteGroupBox
- Inherits UserControl
- Private panelMain As GroupBox
- Public Sub New()
- MyBase.New()
- InitializeComponent()
- End Sub
- Private Sub InitializeComponent()
- Me.panelMain = New System.Windows.Forms.GroupBox
- Me.SuspendLayout()
- Dim Background As Color = Color.FromArgb(42, 42, 42)
- '
- ' panelMain
- '
- Me.panelMain.BackColor = Background
- Me.panelMain.Dock = System.Windows.Forms.DockStyle.Fill
- Me.panelMain.Location = New System.Drawing.Point(0, 0)
- Me.panelMain.Name = "eliteGroupBoxMain"
- Me.panelMain.Size = New System.Drawing.Size(140, 140)
- Me.panelMain.TabIndex = 0
- '
- ' myPanel
- '
- Me.Controls.Add(Me.panelMain)
- Me.Name = "eliteGroupBox"
- Me.ResumeLayout(False)
- End Sub
- End Class
- '###genesisTheme###
- #Region "Enums for Options"
- Public Enum MultiColor
- Black = 0
- Green = 1
- Blue = 2
- Pink = 3
- End Enum
- Public Enum HoverOptions
- Green = 0
- Blue = 1
- Pink = 2
- End Enum
- Public Enum HatchColors
- White = 0
- Green = 1
- Blue = 2
- Pink = 3
- End Enum
- Public Enum IsHatched
- Yes = 0
- No = 1
- End Enum
- #End Region
- #Region "Theme"
- Class genesisTheme
- Inherits ThemeContainer154
- ' White hatch color
- #Region "Text Location"
- Public Enum TextLocation
- Left = 0
- 'if there isn't an icon
- LeftIcon = 1
- 'if there is an icon
- Center = 2
- CenterIcon = 3
- End Enum
- Private _location As TextLocation
- Public Property TextPlacement() As TextLocation
- Get
- Return Me._location
- End Get
- Set(value As TextLocation)
- Me._location = value
- Invalidate()
- End Set
- End Property
- Private _textcolor As MultiColor
- Public Property TextColor() As MultiColor
- Get
- Return Me._textcolor
- End Get
- Set(value As MultiColor)
- Me._textcolor = value
- Invalidate()
- End Set
- End Property
- #End Region
- #Region "Hatch Options"
- Private _color As HatchColors
- Public Property CurrentColor() As HatchColors
- Get
- Return Me._color
- End Get
- Set(value As HatchColors)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Private _yesno As IsHatched
- Public Property HatchONOff() As IsHatched
- Get
- Return Me._yesno
- End Get
- Set(value As IsHatched)
- Me._yesno = value
- Invalidate()
- End Set
- End Property
- #End Region
- #Region "IconSettings"
- Private IconLocation As Icon
- Public Property CustomIcon() As Icon
- Get
- Return IconLocation
- End Get
- Set(value As Icon)
- IconLocation = value
- End Set
- End Property
- Public Enum UseIcon
- No = 0
- Yes = 1
- End Enum
- Private _iconyesno As UseIcon
- Public Property UseAnIcon() As UseIcon
- Get
- Return Me._iconyesno
- End Get
- Set(value As UseIcon)
- Me._iconyesno = value
- Invalidate()
- End Set
- End Property
- #End Region
- Public Sub New()
- BackColor = Color.FromArgb(250, 250, 250)
- SetColor("Back", 250, 250, 250)
- SetColor("Gradient1", 254, 254, 254)
- SetColor("Gradient2", 243, 243, 243)
- SetColor("Border1", 240, 240, 240)
- SetColor("Border2", 254, 254, 254)
- SetColor("Border3", 200, 200, 200)
- SetColor("Line1", 250, 250, 250)
- SetColor("Line2", 240, 240, 240)
- SetColor("Shade1", 70, Color.White)
- SetColor("Shade2", Color.Transparent)
- End Sub
- Private C1 As Color
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private P1 As Pen
- Private P2 As Pen
- Private P3 As Pen
- Private P4 As Pen
- Private P5 As Pen
- Private B1 As HatchBrush
- Private B2 As SolidBrush
- Protected Overrides Sub ColorHook()
- C1 = GetColor("Back")
- C2 = GetColor("Gradient1")
- C3 = GetColor("Gradient2")
- C4 = GetColor("Shade1")
- C5 = GetColor("Shade2")
- P1 = New Pen(GetColor("Border1"))
- P2 = New Pen(GetColor("Line1"))
- P3 = New Pen(GetColor("Line2"))
- P4 = New Pen(GetColor("Border2"))
- P5 = New Pen(GetColor("Border3"))
- BackColor = C1
- End Sub
- Private RT1 As Rectangle
- Protected Overrides Sub PaintHook()
- G.Clear(C1)
- RT1 = New Rectangle(1, 1, Width - 2, 22)
- DrawGradient(C2, C3, RT1, 90.0F)
- DrawBorders(P1, RT1)
- G.DrawLine(P2, 0, 23, Width, 23)
- Select Case _yesno
- Case IsHatched.Yes
- Select Case _color
- Case HatchColors.White
- SetColor("Hatch1", 254, 254, 254)
- SetColor("Hatch2", 248, 248, 248)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Blue
- SetColor("Hatch1", 78, 205, 196)
- SetColor("Hatch2", 72, 199, 190)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Green
- SetColor("Hatch1", 199, 244, 100)
- SetColor("Hatch2", 193, 238, 94)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Pink
- SetColor("Hatch1", 255, 107, 107)
- SetColor("Hatch2", 249, 101, 101)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- End Select
- Exit Select
- Case IsHatched.No
- Select Case _color
- Case HatchColors.White
- SetColor("Hatch1", 254, 254, 254)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Blue
- SetColor("Hatch1", 78, 205, 196)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Green
- SetColor("Hatch1", 199, 244, 100)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Pink
- SetColor("Hatch1", 255, 107, 107)
- SetColor("Hatch2", 249, 101, 101)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- End Select
- Exit Select
- End Select
- Select Case _textcolor
- Case MultiColor.Black
- SetColor("Text", 24, 24, 24)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Blue
- SetColor("Text", 78, 205, 196)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Green
- SetColor("Text", 199, 244, 100)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Pink
- SetColor("Text", 255, 107, 107)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- End Select
- G.FillRectangle(B1, 0, 24, Width, 13)
- DrawGradient(C4, C5, 0, 24, Width, 6)
- G.DrawLine(P3, 0, 37, Width, 37)
- DrawBorders(P4, 1, 38, Width - 2, Height - 39)
- Select Case _iconyesno
- Case UseIcon.Yes
- Dim ico As New Icon(IconLocation, New Size(16, 16))
- Select Case _location
- Case TextLocation.Left
- DrawText(B2, HorizontalAlignment.Left, 1, -2)
- Exit Select
- Case TextLocation.LeftIcon
- G.DrawIconUnstretched(DirectCast(ico, System.Drawing.Icon), RT1)
- DrawText(B2, HorizontalAlignment.Left, 18, -2)
- Exit Select
- Case TextLocation.Center
- DrawText(B2, HorizontalAlignment.Center, 0, -2)
- Exit Select
- Case TextLocation.CenterIcon
- G.DrawIconUnstretched(DirectCast(ico, System.Drawing.Icon), RT1)
- DrawText(B2, HorizontalAlignment.Center, 0, -2)
- Exit Select
- End Select
- Exit Select
- Case UseIcon.No
- Select Case _location
- Case TextLocation.Left
- DrawText(B2, HorizontalAlignment.Left, 1, -2)
- Exit Select
- Case TextLocation.LeftIcon
- DrawText(B2, HorizontalAlignment.Left, 1, -2)
- Exit Select
- Case TextLocation.Center
- DrawText(B2, HorizontalAlignment.Center, 0, -2)
- Exit Select
- Case TextLocation.CenterIcon
- DrawText(B2, HorizontalAlignment.Center, 0, -2)
- Exit Select
- End Select
- Exit Select
- End Select
- DrawBorders(P5)
- End Sub
- End Class
- #End Region
- #Region "Button"
- Class genesisButton
- Inherits ThemeControl154
- Private _color As MultiColor
- Public Property CurrentColor() As MultiColor
- Get
- Return Me._color
- End Get
- Set(value As MultiColor)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Public Sub New()
- SetColor("DownGradient1", 252, 252, 252)
- SetColor("DownGradient2", 238, 238, 238)
- SetColor("NoneGradient1", 240, 240, 240)
- SetColor("NoneGradient2", 254, 254, 254)
- SetColor("HoverGradient1", 238, 238, 238)
- SetColor("HoverGradient2", 252, 252, 252)
- SetColor("TextShade", 30, 35, 35, 35)
- SetColor("Border1", 225, 225, 225)
- SetColor("Border2", 235, 235, 235)
- End Sub
- Private C1 As Color
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- Private B2 As SolidBrush
- Private P1 As Pen
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C1 = GetColor("DownGradient1")
- C2 = GetColor("DownGradient2")
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- C5 = GetColor("HoverGradient1")
- C6 = GetColor("HoverGradient2")
- B1 = New SolidBrush(GetColor("TextShade"))
- P1 = New Pen(GetColor("Border1"))
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- If State = MouseState.Down Then
- DrawGradient(C2, C1, ClientRectangle, 90.0F)
- ElseIf State = MouseState.Over Then
- DrawGradient(C6, C5, ClientRectangle, 90.0F)
- Else
- DrawGradient(C4, C3, ClientRectangle, 90.0F)
- End If
- DrawBorders(P1, 1)
- DrawBorders(P2)
- DrawCorners(BackColor)
- Select Case _color
- Case MultiColor.Black
- SetColor("Text", 24, 24, 24)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Blue
- SetColor("Text", 78, 205, 196)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Green
- SetColor("Text", 199, 244, 100)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Pink
- SetColor("Text", 255, 107, 107)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- End Select
- DrawText(B1, HorizontalAlignment.Center, 1, 1)
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- End Sub
- End Class
- #End Region
- #Region "Label"
- Partial Public Class genesisLabel
- Inherits Label
- #Region "Public Constructors"
- Private _color As MultiColor
- Public Property CurrentColor() As MultiColor
- Get
- Return Me._color
- End Get
- Set(value As MultiColor)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Public Sub New()
- Me.AutoSize = False
- End Sub
- #End Region
- #Region "Protected Overridden Methods"
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- MyBase.OnPaint(e)
- Select Case _color
- Case MultiColor.Black
- Me.ForeColor = Color.FromArgb(24, 24, 24)
- Exit Select
- Case MultiColor.Blue
- Me.ForeColor = Color.FromArgb(78, 205, 196)
- Exit Select
- Case MultiColor.Green
- Me.ForeColor = Color.FromArgb(199, 244, 100)
- Exit Select
- Case MultiColor.Pink
- Me.ForeColor = Color.FromArgb(255, 107, 107)
- Exit Select
- End Select
- End Sub
- Protected Overrides Sub OnResize(e As EventArgs)
- MyBase.OnResize(e)
- Me.FitToContents()
- End Sub
- Protected Overrides Sub OnTextChanged(e As EventArgs)
- MyBase.OnTextChanged(e)
- Me.FitToContents()
- End Sub
- #End Region
- #Region "Protected Virtual Methods"
- Protected Overridable Sub FitToContents()
- Dim size As Size
- size = Me.GetPreferredSize(New Size(Me.Width, 0))
- Me.Height = size.Height
- End Sub
- #End Region
- #Region "Public Properties"
- <DefaultValue(False), Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
- Public Overrides Property AutoSize() As Boolean
- Get
- Return MyBase.AutoSize
- End Get
- Set(value As Boolean)
- MyBase.AutoSize = value
- End Set
- End Property
- #End Region
- End Class
- #End Region
- #Region "Draw Class"
- Public Class Draw
- Public Shared Sub Gradient(g As Graphics, c1 As Color, c2 As Color, x As Integer, y As Integer, width As Integer, _
- height As Integer)
- Dim R As New Rectangle(x, y, width, height)
- Using T As New LinearGradientBrush(R, c1, c2, LinearGradientMode.Vertical)
- g.FillRectangle(T, R)
- End Using
- End Sub
- Public Shared Sub Blend(g As Graphics, c1 As Color, c2 As Color, c3 As Color, c As Single, d As Integer, _
- x As Integer, y As Integer, width As Integer, height As Integer)
- Dim V As New ColorBlend(3)
- V.Colors = New Color() {c1, c2, c3}
- V.Positions = New Single() {0.0F, c, 1.0F}
- Dim R As New Rectangle(x, y, width, height)
- Using T As New LinearGradientBrush(R, c1, c1, DirectCast(d, LinearGradientMode))
- T.InterpolationColors = V
- g.FillRectangle(T, R)
- End Using
- End Sub
- End Class
- #End Region
- #Region "Seperator"
- Friend Class genesisSeperator
- Inherits Control
- Private _Orientation As Orientation
- Public Property Orientation() As Orientation
- Get
- Return _Orientation
- End Get
- Set(value As Orientation)
- _Orientation = value
- UpdateOffset()
- Invalidate()
- End Set
- End Property
- Private G As Graphics
- Private B As Bitmap
- Private I As Integer
- Private C1 As Color
- Private P1 As Pen
- Private P2 As Pen
- Public Sub New()
- SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
- C1 = Color.FromArgb(250, 250, 250)
- 'Background
- P1 = New Pen(Color.FromArgb(230, 230, 230))
- 'Shadow
- 'Highlight
- P2 = New Pen(Color.FromArgb(255, 255, 255))
- End Sub
- Protected Overrides Sub OnSizeChanged(e As EventArgs)
- UpdateOffset()
- MyBase.OnSizeChanged(e)
- End Sub
- Public Sub UpdateOffset()
- I = Convert.ToInt32((If((_Orientation = 0), Height / 2 - 1, Width / 2 - 1)))
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- B = New Bitmap(Width, Height)
- G = Graphics.FromImage(B)
- G.Clear(C1)
- If _Orientation = 0 Then
- G.DrawLine(P1, 0, I, Width, I)
- G.DrawLine(P2, 0, I + 1, Width, I + 1)
- Else
- G.DrawLine(P2, I, 0, I, Height)
- G.DrawLine(P1, I + 1, 0, I + 1, Height)
- End If
- e.Graphics.DrawImage(B, 0, 0)
- G.Dispose()
- B.Dispose()
- End Sub
- Protected Overrides Sub OnPaintBackground(pevent As PaintEventArgs)
- End Sub
- End Class
- #End Region
- #Region "Pigment"
- Class Pigment
- Public Property Name() As String
- Get
- Return m_Name
- End Get
- Set(value As String)
- m_Name = Value
- End Set
- End Property
- Private m_Name As String
- Public Property Value() As Color
- Get
- Return m_Value
- End Get
- Set(value As Color)
- m_Value = Value
- End Set
- End Property
- Private m_Value As Color
- Public Sub New()
- End Sub
- Public Sub New(n As String, v As Color)
- Name = n
- Value = v
- End Sub
- Public Sub New(n As String, a As Byte, r As Byte, g As Byte, b As Byte)
- Name = n
- Value = Color.FromArgb(a, r, g, b)
- End Sub
- Public Sub New(n As String, r As Byte, g As Byte, b As Byte)
- Name = n
- Value = Color.FromArgb(r, g, b)
- End Sub
- End Class
- #End Region
- #Region "Progress Bar"
- Class genesisProgressBar
- Inherits ThemeControl154
- #Region "Properties"
- Private _Maximum As Integer = 100
- Public Property Maximum() As Integer
- Get
- Return _Maximum
- End Get
- Set(value As Integer)
- If value < 1 Then
- value = 1
- End If
- If value < _Value Then
- _Value = value
- End If
- If _Maximum < _Minimum Then
- _Minimum = value
- End If
- _Maximum = value
- Invalidate()
- End Set
- End Property
- Private _Minimum As Integer = 0
- Public Property Minimum() As Integer
- Get
- Return _Minimum
- End Get
- Set(value As Integer)
- If _Minimum > _Maximum Then
- _Maximum = _Minimum
- End If
- If _Minimum > _Value Then
- _Value = _Minimum
- End If
- _Minimum = value
- Invalidate()
- End Set
- End Property
- Private _Value As Integer = 0
- Public Property Value() As Integer
- Get
- Return _Value
- End Get
- Set(value As Integer)
- If value > _Maximum Then
- value = _Maximum
- End If
- If value < _Minimum Then
- value = _Minimum
- End If
- _Value = value
- Invalidate()
- End Set
- End Property
- #End Region
- #Region "Hatch Options"
- Private _color As HatchColors
- Public Property CurrentColor() As HatchColors
- Get
- Return Me._color
- End Get
- Set(value As HatchColors)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Private _yesno As IsHatched
- Public Property HatchONOff() As IsHatched
- Get
- Return Me._yesno
- End Get
- Set(value As IsHatched)
- Me._yesno = value
- Invalidate()
- End Set
- End Property
- #End Region
- Public Sub New()
- SetColor("Background", Color.FromArgb(245, 245, 245))
- SetColor("Border1", 235, 235, 235)
- SetColor("Border2", 245, 245, 245)
- End Sub
- Private ProgressBarColor As Color
- Private B1 As HatchBrush
- Private P1 As Pen
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- ProgressBarColor = GetColor("Background")
- P1 = New Pen(GetColor("Border1"))
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- G.Clear(ProgressBarColor)
- DrawGradient(ProgressBarColor, ProgressBarColor, ClientRectangle, 90.0F)
- Select Case _yesno
- Case IsHatched.Yes
- Select Case _color
- Case HatchColors.White
- SetColor("Hatch1", 245, 245, 245)
- SetColor("Hatch2", 235, 235, 235)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Blue
- SetColor("Hatch1", 78, 205, 196)
- SetColor("Hatch2", 72, 199, 190)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Green
- SetColor("Hatch1", 199, 244, 100)
- SetColor("Hatch2", 193, 238, 94)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Pink
- SetColor("Hatch1", 255, 107, 107)
- SetColor("Hatch2", 249, 101, 101)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- End Select
- Exit Select
- Case IsHatched.No
- Select Case _color
- Case HatchColors.White
- SetColor("Hatch1", 245, 245, 245)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Blue
- SetColor("Hatch1", 78, 205, 196)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Green
- SetColor("Hatch1", 199, 244, 100)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Pink
- SetColor("Hatch1", 255, 107, 107)
- SetColor("Hatch2", 249, 101, 101)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- End Select
- Exit Select
- End Select
- G.FillRectangle(B1, 2, 2, (Width * _Value) \ (_Maximum - _Minimum), Height)
- DrawBorders(P1, 1)
- DrawBorders(P2)
- DrawCorners(BackColor)
- End Sub
- Public Sub Increment(num As Integer)
- Me._Value += num
- Invalidate()
- End Sub
- Public Sub Deincrement(num As Integer)
- Me._Value -= num
- Invalidate()
- End Sub
- End Class
- #End Region
- #Region "Checkbox"
- ' This is used to see if it is a checkbox and so on.
- <DefaultEvent("CheckedChanged")> _
- Class genesisCheckBox
- Inherits ThemeControl154
- ' This Checkbox uses a green middle
- #Region "Text Options"
- Private _text As MultiColor
- Public Property TextColor() As MultiColor
- Get
- Return Me._text
- End Get
- Set(value As MultiColor)
- Me._text = value
- Invalidate()
- End Set
- End Property
- #End Region
- #Region "Hatch Options"
- Private _color As HatchColors
- Public Property CurrentColor() As HatchColors
- Get
- Return Me._color
- End Get
- Set(value As HatchColors)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Private _yesno As IsHatched
- Public Property HatchONOff() As IsHatched
- Get
- Return Me._yesno
- End Get
- Set(value As IsHatched)
- Me._yesno = value
- Invalidate()
- End Set
- End Property
- #End Region
- Public Sub New()
- Transparent = True
- ' it is infact transpernt
- BackColor = Color.Transparent
- ' no lockheight since that way they can choose how they want it.
- ' no text since i want the user to choose wether or not they want check, also, that way the border doesn't go around it.
- SetColor("Background", 249, 249, 249)
- ' Background is Dark
- SetColor("Border1", 235, 235, 235)
- ' The Inside Border
- ' The Outside Border
- SetColor("Border2", 249, 249, 249)
- End Sub
- ' set up the variables
- Private C1 As Color
- ' Set up Simple Colors
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Private B1 As HatchBrush
- Protected Overrides Sub ColorHook()
- C1 = GetColor("Background")
- ' Get the Colors for the Button Shading
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- G.Clear(BackColor)
- Select Case _Checked
- Case True
- 'Put your checked state here
- Select Case _yesno
- Case IsHatched.Yes
- Select Case _color
- Case HatchColors.White
- SetColor("Hatch1", 250, 250, 250)
- SetColor("Hatch2", 244, 244, 244)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Blue
- SetColor("Hatch1", 78, 205, 196)
- SetColor("Hatch2", 72, 199, 190)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Green
- SetColor("Hatch1", 199, 244, 100)
- SetColor("Hatch2", 193, 238, 94)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Pink
- SetColor("Hatch1", 255, 107, 107)
- SetColor("Hatch2", 249, 101, 101)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- End Select
- Exit Select
- Case IsHatched.No
- Select Case _color
- Case HatchColors.White
- SetColor("Hatch1", 250, 250, 250)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Blue
- SetColor("Hatch1", 78, 205, 196)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Green
- SetColor("Hatch1", 199, 244, 100)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Pink
- SetColor("Hatch1", 255, 107, 107)
- SetColor("Hatch2", 249, 101, 101)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- End Select
- Exit Select
- End Select
- DrawGradient(C1, C1, ClientRectangle, 90.0F)
- ' checked background
- G.FillRectangle(B1, 3, 3, Me.Width - 6, Me.Height - 6)
- DrawBorders(P1, 1)
- ' Create the Inner Border
- Me.Height = Me.Width
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- Exit Select
- Case False
- 'Put your unchecked state here
- DrawGradient(C1, C1, ClientRectangle, 90.0F)
- ' unchecked background
- DrawBorders(P1, 1)
- ' Create the Inner Border
- Me.Height = Me.Width
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- Exit Select
- End Select
- End Sub
- Private Property _Checked() As Boolean
- Get
- Return m__Checked
- End Get
- Set(value As Boolean)
- m__Checked = Value
- End Set
- End Property
- Private m__Checked As Boolean
- Public Property Checked() As Boolean
- Get
- Return _Checked
- End Get
- Set(value As Boolean)
- _Checked = value
- End Set
- End Property
- Protected Overrides Sub OnClick(e As System.EventArgs)
- _Checked = Not _Checked
- RaiseEvent CheckedChanged(Me)
- MyBase.OnClick(e)
- End Sub
- Public Event CheckedChanged As CheckedChangedEventHandler
- Public Delegate Sub CheckedChangedEventHandler(sender As Object)
- End Class
- #End Region
- #Region "MaximizeButton"
- Class genesisMaximize
- Inherits ThemeControl154
- ' A Hide Button
- Private _color As HoverOptions
- Public Property HoverColor() As HoverOptions
- Get
- Return Me._color
- End Get
- Set(value As HoverOptions)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Public Property WindowState() As FormWindowState
- Get
- Return m_WindowState
- End Get
- Set(value As FormWindowState)
- m_WindowState = Value
- End Set
- End Property
- Private m_WindowState As FormWindowState
- Public Sub New()
- SetColor("NoneGradient1", 235, 235, 235)
- SetColor("NoneGradient2", 245, 245, 245)
- SetColor("Text", 24, 24, 24)
- ' The Color for the Text
- SetColor("Texthover", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 225, 225, 225)
- ' The Inside Border
- ' The Outside Border
- SetColor("Border2", 235, 235, 235)
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private B2 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- B2 = New SolidBrush(GetColor("Texthover"))
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- Select Case _color
- Case HoverOptions.Blue
- SetColor("DownGradient1", 72, 199, 190)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 78, 205, 196)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 72, 199, 190)
- SetColor("ClickedGradient2", 78, 205, 196)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- Case HoverOptions.Green
- SetColor("DownGradient1", 193, 238, 94)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 199, 244, 100)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 193, 238, 94)
- SetColor("ClickedGradient2", 199, 244, 100)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- Case HoverOptions.Pink
- SetColor("DownGradient1", 249, 101, 101)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 255, 107, 107)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 249, 101, 101)
- SetColor("ClickedGradient2", 255, 107, 107)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- End Select
- If Me.State = MouseState.Over Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0F)
- ' if button is hovered over
- If Application.OpenForms(0).WindowState = FormWindowState.Normal Then
- Me.Text = "+"
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- ElseIf Application.OpenForms(0).WindowState = FormWindowState.Maximized Then
- Me.Text = "-" & ChrW(127) & ChrW(127)
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- End If
- ElseIf Me.State = MouseState.Down Then
- DrawGradient(C6, C5, ClientRectangle, 90.0F)
- If Application.OpenForms(0).WindowState = FormWindowState.Normal Then
- Me.Text = "+"
- System.Threading.Thread.Sleep(100)
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- Application.OpenForms(0).WindowState = FormWindowState.Maximized
- Me.Text = "-"
- ElseIf Application.OpenForms(0).WindowState = FormWindowState.Maximized Then
- Me.Text = "-"
- System.Threading.Thread.Sleep(100)
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- Application.OpenForms(0).WindowState = FormWindowState.Normal
- Me.Text = "+"
- End If
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0F)
- ' else change the shading
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- End If
- Me.Width = 17
- Me.Height = 17
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- #End Region
- #Region "HideButton"
- Class genesisHide
- Inherits ThemeControl154
- ' A Hide Button
- Private _color As HoverOptions
- Public Property HoverColor() As HoverOptions
- Get
- Return Me._color
- End Get
- Set(value As HoverOptions)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Public Property WindowState() As FormWindowState
- Get
- Return m_WindowState
- End Get
- Set(value As FormWindowState)
- m_WindowState = Value
- End Set
- End Property
- Private m_WindowState As FormWindowState
- Public Sub New()
- SetColor("NoneGradient1", 235, 235, 235)
- SetColor("NoneGradient2", 245, 245, 245)
- SetColor("Text", 24, 24, 24)
- ' The Color for the Text
- SetColor("Texthover", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 225, 225, 225)
- ' The Inside Border
- ' The Outside Border
- SetColor("Border2", 235, 235, 235)
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private B2 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- B2 = New SolidBrush(GetColor("Texthover"))
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- Select Case _color
- Case HoverOptions.Blue
- SetColor("DownGradient1", 72, 199, 190)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 78, 205, 196)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 72, 199, 190)
- SetColor("ClickedGradient2", 78, 205, 196)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- Case HoverOptions.Green
- SetColor("DownGradient1", 193, 238, 94)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 199, 244, 100)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 193, 238, 94)
- SetColor("ClickedGradient2", 199, 244, 100)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- Case HoverOptions.Pink
- SetColor("DownGradient1", 249, 101, 101)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 255, 107, 107)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 249, 101, 101)
- SetColor("ClickedGradient2", 255, 107, 107)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- End Select
- If Me.State = MouseState.Over Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0F)
- ' if button is hovered over
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- Me.Text = "_"
- ElseIf Me.State = MouseState.Down Then
- DrawGradient(C6, C5, ClientRectangle, 90.0F)
- Me.Text = "_"
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- Application.OpenForms(0).WindowState = FormWindowState.Minimized
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0F)
- ' else change the shading
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- End If
- Me.Width = 17
- Me.Height = 17
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- #End Region
- #Region "CloseButton"
- Class genesisClose
- Inherits ThemeControl154
- ' A Hide Button
- Private _color As HoverOptions
- Public Property HoverColor() As HoverOptions
- Get
- Return Me._color
- End Get
- Set(value As HoverOptions)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Public Property WindowState() As FormWindowState
- Get
- Return m_WindowState
- End Get
- Set(value As FormWindowState)
- m_WindowState = Value
- End Set
- End Property
- Private m_WindowState As FormWindowState
- Public Sub New()
- SetColor("NoneGradient1", 235, 235, 235)
- SetColor("NoneGradient2", 245, 245, 245)
- SetColor("Text", 24, 24, 24)
- ' The Color for the Text
- SetColor("Texthover", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 225, 225, 225)
- ' The Inside Border
- ' The Outside Border
- SetColor("Border2", 235, 235, 235)
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private B2 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- B2 = New SolidBrush(GetColor("Texthover"))
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- Select Case _color
- Case HoverOptions.Blue
- SetColor("DownGradient1", 72, 199, 190)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 78, 205, 196)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 72, 199, 190)
- SetColor("ClickedGradient2", 78, 205, 196)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- Case HoverOptions.Green
- SetColor("DownGradient1", 193, 238, 94)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 199, 244, 100)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 193, 238, 94)
- SetColor("ClickedGradient2", 199, 244, 100)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- Case HoverOptions.Pink
- SetColor("DownGradient1", 249, 101, 101)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 255, 107, 107)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 249, 101, 101)
- SetColor("ClickedGradient2", 255, 107, 107)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- End Select
- If Me.State = MouseState.Over Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0F)
- ' if button is hovered over
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- ' Draw the Text Smack dab in the middle of the button
- Me.Text = "x"
- ElseIf Me.State = MouseState.Down Then
- DrawGradient(C6, C5, ClientRectangle, 90.0F)
- Me.Text = "x"
- Application.[Exit]()
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0F)
- ' else change the shading
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- End If
- Me.Width = 17
- Me.Height = 17
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- #End Region
- #Region "TopButton"
- Class genesisTopButton
- Inherits ThemeControl154
- ' A Hide Button
- Private _color As HoverOptions
- Public Property HoverColor() As HoverOptions
- Get
- Return Me._color
- End Get
- Set(value As HoverOptions)
- Me._color = value
- Invalidate()
- End Set
- End Property
- Public Property WindowState() As FormWindowState
- Get
- Return m_WindowState
- End Get
- Set(value As FormWindowState)
- m_WindowState = Value
- End Set
- End Property
- Private m_WindowState As FormWindowState
- Public Sub New()
- SetColor("NoneGradient1", 235, 235, 235)
- SetColor("NoneGradient2", 245, 245, 245)
- SetColor("Text", 24, 24, 24)
- ' The Color for the Text
- SetColor("Texthover", 254, 254, 254)
- ' The Color for the Text
- SetColor("Border1", 225, 225, 225)
- ' The Inside Border
- ' The Outside Border
- SetColor("Border2", 235, 235, 235)
- End Sub
- Private C1 As Color
- ' Set up Simple Colors
- Private C2 As Color
- Private C3 As Color
- Private C4 As Color
- Private C5 As Color
- Private C6 As Color
- Private B1 As SolidBrush
- ' A Brush to use text
- Private B2 As SolidBrush
- ' A Brush to use text
- Private P1 As Pen
- ' A Pen used to create borders
- Private P2 As Pen
- Protected Overrides Sub ColorHook()
- C3 = GetColor("NoneGradient1")
- C4 = GetColor("NoneGradient2")
- B1 = New SolidBrush(GetColor("Text"))
- ' Set up Color for the Text
- B2 = New SolidBrush(GetColor("Texthover"))
- P1 = New Pen(GetColor("Border1"))
- ' Get and create the borders for the Buttons
- P2 = New Pen(GetColor("Border2"))
- End Sub
- Protected Overrides Sub PaintHook()
- Select Case _color
- Case HoverOptions.Blue
- SetColor("DownGradient1", 72, 199, 190)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 78, 205, 196)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 72, 199, 190)
- SetColor("ClickedGradient2", 78, 205, 196)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- Case HoverOptions.Green
- SetColor("DownGradient1", 193, 238, 94)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 199, 244, 100)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 193, 238, 94)
- SetColor("ClickedGradient2", 199, 244, 100)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- Case HoverOptions.Pink
- SetColor("DownGradient1", 249, 101, 101)
- ' Basic Gradients Used to Shade the Button
- SetColor("DownGradient2", 255, 107, 107)
- ' The Gradients are reversed, depending on if Button is Pressed or not
- SetColor("ClickedGradient1", 249, 101, 101)
- SetColor("ClickedGradient2", 255, 107, 107)
- C1 = GetColor("DownGradient1")
- ' Get the Colors for the Button Shading
- C2 = GetColor("DownGradient2")
- C5 = GetColor("ClickedGradient1")
- C6 = GetColor("ClickedGradient2")
- Exit Select
- End Select
- If Me.State = MouseState.Over Then
- ' Used to see if button is Hovered over
- DrawGradient(C1, C2, ClientRectangle, 90.0F)
- ' if button is hovered over
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- ElseIf Me.State = MouseState.Down Then
- DrawGradient(C6, C5, ClientRectangle, 90.0F)
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B2, HorizontalAlignment.Center, 0, 0)
- Else
- DrawGradient(C3, C4, ClientRectangle, 90.0F)
- ' else change the shading
- ' Draw the Text Smack dab in the middle of the button
- DrawText(B1, HorizontalAlignment.Center, 0, 0)
- End If
- Me.Width = 17
- Me.Height = 17
- DrawBorders(P1, 1)
- ' Create the Inner Border
- DrawBorders(P2)
- ' Create the Outer Border
- DrawCorners(BackColor)
- ' Draw the Corners
- End Sub
- End Class
- #End Region
- #Region "Groupbox"
- Class genesisGroupBox
- Inherits ThemeContainer154
- #Region "Text Location"
- Public Enum TextLocation
- Left = 0
- Center = 1
- Right = 2
- End Enum
- Private _location As TextLocation
- Public Property TextPlacement() As TextLocation
- Get
- Return Me._location
- End Get
- Set(value As TextLocation)
- Me._location = value
- Invalidate()
- End Set
- End Property
- #End Region
- #Region "TextColor"
- Public Enum MultiColor
- Black = 0
- White = 1
- Green = 2
- Blue = 3
- Pink = 4
- End Enum
- Private _color As MultiColor
- Public Property TextColor() As MultiColor
- Get
- Return Me._color
- End Get
- Set(value As MultiColor)
- Me._color = value
- Invalidate()
- End Set
- End Property
- #End Region
- #Region "Hatch Options"
- Private _hatchcolor As HatchColors
- Public Property HatchColor() As HatchColors
- Get
- Return Me._hatchcolor
- End Get
- Set(value As HatchColors)
- Me._hatchcolor = value
- Invalidate()
- End Set
- End Property
- Private _yesno As IsHatched
- Public Property HatchONOff() As IsHatched
- Get
- Return Me._yesno
- End Get
- Set(value As IsHatched)
- Me._yesno = value
- Invalidate()
- End Set
- End Property
- #End Region
- Public Sub New()
- ControlMode = True
- Header = 26
- End Sub
- Private B1 As HatchBrush
- Private B2 As SolidBrush
- Protected Overrides Sub ColorHook()
- End Sub
- Protected Overrides Sub PaintHook()
- Select Case _yesno
- Case IsHatched.Yes
- Select Case _hatchcolor
- Case HatchColors.White
- SetColor("Hatch1", 254, 254, 254)
- SetColor("Hatch2", 248, 248, 248)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Blue
- SetColor("Hatch1", 78, 205, 196)
- SetColor("Hatch2", 72, 199, 190)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Green
- SetColor("Hatch1", 199, 244, 100)
- SetColor("Hatch2", 193, 238, 94)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- Case HatchColors.Pink
- SetColor("Hatch1", 255, 107, 107)
- SetColor("Hatch2", 249, 101, 101)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
- Exit Select
- End Select
- Exit Select
- Case IsHatched.No
- Select Case _hatchcolor
- Case HatchColors.White
- SetColor("Hatch1", 254, 254, 254)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Blue
- SetColor("Hatch1", 78, 205, 196)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Green
- SetColor("Hatch1", 199, 244, 100)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- Case HatchColors.Pink
- SetColor("Hatch1", 255, 107, 107)
- SetColor("Hatch2", 249, 101, 101)
- B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
- Exit Select
- End Select
- Exit Select
- End Select
- G.Clear(Color.FromArgb(249, 249, 249))
- G.FillRectangle(B1, 5, 5, Width - 10, 26)
- G.DrawLine(New Pen(Color.FromArgb(20, Color.White)), 7, 7, Width - 8, 7)
- DrawBorders(New Pen(Color.FromArgb(220, 220, 220)), 5, 5, Width - 10, 26, 1)
- DrawBorders(New Pen(Color.FromArgb(236, 236, 236)), 5, 5, Width - 10, 26)
- DrawBorders(New Pen(Color.FromArgb(60, 208, 208, 208)), 5, 34, Width - 10, Height - 39, 1)
- DrawBorders(New Pen(Color.FromArgb(236, 236, 236)), 5, 34, Width - 10, Height - 39)
- DrawBorders(New Pen(Color.FromArgb(236, 236, 236)), 1)
- DrawBorders(New Pen(Color.FromArgb(236, 236, 236)))
- G.DrawLine(New Pen(Color.FromArgb(248, 248, 248)), 1, 1, Width - 2, 1)
- Select Case _color
- Case MultiColor.White
- SetColor("Text", 254, 254, 254)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Black
- SetColor("Text", 24, 24, 24)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Blue
- SetColor("Text", 78, 205, 196)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Green
- SetColor("Text", 199, 244, 100)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- Case MultiColor.Pink
- SetColor("Text", 255, 107, 107)
- B2 = New SolidBrush(GetColor("Text"))
- Exit Select
- End Select
- Select Case _location
- Case TextLocation.Left
- DrawText(B2, HorizontalAlignment.Left, 9, 5)
- Exit Select
- Case TextLocation.Center
- DrawText(B2, HorizontalAlignment.Center, 0, 5)
- Exit Select
- Case TextLocation.Right
- DrawText(B2, HorizontalAlignment.Right, 10, 5)
- Exit Select
- End Select
- End Sub
- End Class
- #End Region
- #Region "Panel"
- Class genesisPanel
- Inherits ThemeContainer154
- Public Sub New()
- ControlMode = True
- Header = 26
- End Sub
- Protected Overrides Sub ColorHook()
- End Sub
- Protected Overrides Sub PaintHook()
- G.Clear(Color.FromArgb(250, 250, 250))
- DrawBorders(New Pen(Color.FromArgb(236, 236, 236)), 1)
- DrawBorders(New Pen(Color.FromArgb(236, 236, 236)))
- G.DrawLine(New Pen(Color.FromArgb(248, 248, 248)), 1, 1, Width - 2, 1)
- End Sub
- End Class
- #End Region
- #Region "Textbox"
- <DefaultEvent("TextChanged")> _
- Class genesisTextBox
- Inherits ThemeControl154
- Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
- Public Property TextAlign() As HorizontalAlignment
- Get
- Return _TextAlign
- End Get
- Set(value As HorizontalAlignment)
- _TextAlign = value
- If Base IsNot Nothing Then
- Base.TextAlign = value
- End If
- End Set
- End Property
- Private _MaxLength As Integer = 32767
- Public Property MaxLength() As Integer
- Get
- Return _MaxLength
- End Get
- Set(value As Integer)
- _MaxLength = value
- If Base IsNot Nothing Then
- Base.MaxLength = value
- End If
- End Set
- End Property
- Private _ReadOnly As Boolean
- Public Property [ReadOnly]() As Boolean
- Get
- Return _ReadOnly
- End Get
- Set(value As Boolean)
- _ReadOnly = value
- If Base IsNot Nothing Then
- Base.[ReadOnly] = value
- End If
- End Set
- End Property
- Private _UseSystemPasswordChar As Boolean
- Public Property UseSystemPasswordChar() As Boolean
- Get
- Return _UseSystemPasswordChar
- End Get
- Set(value As Boolean)
- _UseSystemPasswordChar = value
- If Base IsNot Nothing Then
- Base.UseSystemPasswordChar = value
- End If
- End Set
- End Property
- Private _Multiline As Boolean
- Public Property Multiline() As Boolean
- Get
- Return _Multiline
- End Get
- Set(value As Boolean)
- _Multiline = value
- If Base IsNot Nothing Then
- Base.Multiline = value
- If value Then
- LockHeight = 0
- Base.Height = Height - 11
- Else
- LockHeight = Base.Height + 11
- End If
- End If
- End Set
- End Property
- Public Overrides Property Text() As String
- Get
- Return MyBase.Text
- End Get
- Set(value As String)
- MyBase.Text = value
- If Base IsNot Nothing Then
- Base.Text = value
- End If
- End Set
- End Property
- Public Overrides Property Font() As Font
- Get
- Return MyBase.Font
- End Get
- Set(value As Font)
- MyBase.Font = value
- If Base IsNot Nothing Then
- Base.Font = value
- Base.Location = New Point(3, 5)
- Base.Width = Width - 6
- If Not _Multiline Then
- LockHeight = Base.Height + 11
- End If
- End If
- End Set
- End Property
- Protected Overrides Sub OnCreation()
- If Not Controls.Contains(Base) Then
- Controls.Add(Base)
- End If
- End Sub
- Private Base As TextBox
- Public Sub New()
- Base = New TextBox()
- Base.Font = Font
- Base.Text = Text
- Base.MaxLength = _MaxLength
- Base.Multiline = _Multiline
- Base.[ReadOnly] = _ReadOnly
- Base.UseSystemPasswordChar = _UseSystemPasswordChar
- Base.BorderStyle = BorderStyle.None
- Base.Location = New Point(4, 4)
- Base.Width = Width - 10
- If _Multiline Then
- Base.Height = Height - 11
- Else
- LockHeight = Base.Height + 11
- End If
- AddHandler Base.TextChanged, AddressOf OnBaseTextChanged
- AddHandler Base.KeyDown, AddressOf OnBaseKeyDown
- SetColor("Text", Color.Black)
- SetColor("Backcolor", 245, 245, 245)
- SetColor("Border", 220, 220, 220)
- End Sub
- Private BG As Color
- Private P1 As Pen
- Protected Overrides Sub ColorHook()
- BG = GetColor("Backcolor")
- P1 = GetPen("Border")
- Base.ForeColor = GetColor("Text")
- Base.BackColor = GetColor("Backcolor")
- End Sub
- Protected Overrides Sub PaintHook()
- G.Clear(BG)
- DrawBorders(P1)
- End Sub
- Private Sub OnBaseTextChanged(s As Object, e As EventArgs)
- Text = Base.Text
- End Sub
- Private Sub OnBaseKeyDown(s As Object, e As KeyEventArgs)
- If e.Control AndAlso e.KeyCode = Keys.A Then
- Base.SelectAll()
- e.SuppressKeyPress = True
- End If
- End Sub
- Protected Overrides Sub OnResize(e As EventArgs)
- Base.Location = New Point(4, 5)
- Base.Width = Width - 8
- If _Multiline Then
- Base.Height = Height - 5
- End If
- MyBase.OnResize(e)
- End Sub
- End Class
- #End Region
- #Region "Listbox"
- Class genesisListbox
- Inherits ListBox
- Public Sub New()
- SetStyle(ControlStyles.DoubleBuffer, True)
- Font = New Font("Microsoft Sans Serif", 9)
- BorderStyle = System.Windows.Forms.BorderStyle.None
- DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
- ItemHeight = 21
- ForeColor = Color.Black
- BackColor = Color.FromArgb(250, 250, 250)
- IntegralHeight = False
- End Sub
- Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
- MyBase.WndProc(m)
- If m.Msg = 15 Then
- CustomPaint()
- End If
- End Sub
- Private _Image As Image
- Public Property ItemImage() As Image
- Get
- Return _Image
- End Get
- Set(value As Image)
- _Image = value
- End Set
- End Property
- Protected Overrides Sub OnDrawItem(e As System.Windows.Forms.DrawItemEventArgs)
- Try
- If e.Index < 0 Then
- Return
- End If
- e.DrawBackground()
- Dim rect As New Rectangle(New Point(e.Bounds.Left, e.Bounds.Top + 2), New Size(Bounds.Width, 16))
- e.DrawFocusRectangle()
- If Strings.InStr(e.State.ToString(), "Selected,") > 0 Then
- Dim x2 As Rectangle = e.Bounds
- Dim x3 As New Rectangle(x2.Location, New Size(x2.Width, (x2.Height / 2)))
- Dim G1 As New LinearGradientBrush(New Point(x2.X, x2.Y), New Point(x2.X, x2.Y + x2.Height), Color.FromArgb(250, 250, 250), Color.FromArgb(210, 210, 210))
- Dim H As New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.FromArgb(10, Color.Black), Color.Transparent)
- e.Graphics.FillRectangle(G1, x2)
- G1.Dispose()
- e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(250, 250, 250)), x3)
- e.Graphics.FillRectangle(H, x2)
- G1.Dispose()
- e.Graphics.DrawString(" " & Items(e.Index).ToString(), Font, Brushes.Black, 5, e.Bounds.Y + (e.Bounds.Height \ 2) - 9)
- e.Graphics.DrawRectangle(New Pen(Color.FromArgb(220, 220, 220)), New Rectangle(New Point(x2.Location.X, x2.Location.Y), New Size(x2.Width, x2.Height)))
- Else
- Dim x2 As Rectangle = e.Bounds
- e.Graphics.DrawString(" " & Items(e.Index).ToString(), Font, Brushes.Black, 5, e.Bounds.Y + (e.Bounds.Height \ 2) - 9)
- e.Graphics.DrawRectangle(New Pen(Color.FromArgb(240, 240, 240)), New Rectangle(New Point(x2.Location.X, x2.Location.Y), New Size(x2.Width, x2.Height)))
- End If
- e.Graphics.DrawRectangle(New Pen(Color.FromArgb(220, 220, 220)), New Rectangle(0, 0, Width - 1, Height - 1))
- MyBase.OnDrawItem(e)
- Catch ex As Exception
- End Try
- End Sub
- Public Sub CustomPaint()
- CreateGraphics().DrawRectangle(New Pen(Color.FromArgb(220, 220, 220)), New Rectangle(0, 0, Width - 1, Height - 1))
- End Sub
- End Class
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment