Guest User

Untitled

a guest
May 21st, 2014
1,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '             Thief3 VB.Net Theme
  2.  
  3. ' #############################################
  4. ' #          Creator: iZ3RO (ZerO)            #
  5. ' #           Date: 30 July, 2011             #
  6. ' #         Site: www.hackforums.net          #
  7. ' #               Version: 3.0                #
  8. ' #############################################
  9.  
  10. '     Credits to AeonHack for the theme base
  11.  
  12.  
  13. Imports System.Drawing.Drawing2D
  14. Imports System.ComponentModel
  15. Imports System.Runtime.InteropServices
  16.  
  17. MustInherit Class Theme
  18.     Inherits ContainerControl
  19.  
  20. #Region " Initialization "
  21.  
  22.     Protected G As Graphics
  23.     Sub New()
  24.         SetStyle(DirectCast(139270, ControlStyles), True)
  25.     End Sub
  26.  
  27.     Private ParentIsForm As Boolean
  28.     Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  29.         Dock = DockStyle.Fill
  30.         ParentIsForm = TypeOf Parent Is Form
  31.         If ParentIsForm Then
  32.             If Not _TransparencyKey = Color.Empty Then ParentForm.TransparencyKey = _TransparencyKey
  33.             ParentForm.FormBorderStyle = FormBorderStyle.None
  34.         End If
  35.         MyBase.OnHandleCreated(e)
  36.     End Sub
  37.  
  38.     Overrides Property Text As String
  39.         Get
  40.             Return MyBase.Text
  41.         End Get
  42.         Set(ByVal v As String)
  43.             MyBase.Text = v
  44.             Invalidate()
  45.         End Set
  46.     End Property
  47. #End Region
  48.  
  49. #Region " Sizing and Movement "
  50.  
  51.     Private _Resizable As Boolean = True
  52.     Property Resizable() As Boolean
  53.         Get
  54.             Return _Resizable
  55.         End Get
  56.         Set(ByVal value As Boolean)
  57.             _Resizable = value
  58.         End Set
  59.     End Property
  60.  
  61.     Private _MoveHeight As Integer = 24
  62.     Property MoveHeight() As Integer
  63.         Get
  64.             Return _MoveHeight
  65.         End Get
  66.         Set(ByVal v As Integer)
  67.             _MoveHeight = v
  68.             Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  69.         End Set
  70.     End Property
  71.  
  72.     Private Flag As IntPtr
  73.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  74.         If Not e.Button = MouseButtons.Left Then Return
  75.         If ParentIsForm Then If ParentForm.WindowState = FormWindowState.Maximized Then Return
  76.  
  77.         If Header.Contains(e.Location) Then
  78.             Flag = New IntPtr(2)
  79.         ElseIf Current.Position = 0 Or Not _Resizable Then
  80.             Return
  81.         Else
  82.             Flag = New IntPtr(Current.Position)
  83.         End If
  84.  
  85.         Capture = False
  86.         DefWndProc(Message.Create(Parent.Handle, 161, Flag, Nothing))
  87.  
  88.         MyBase.OnMouseDown(e)
  89.     End Sub
  90.  
  91.     Private Structure Pointer
  92.         ReadOnly Cursor As Cursor, Position As Byte
  93.         Sub New(ByVal c As Cursor, ByVal p As Byte)
  94.             Cursor = c
  95.             Position = p
  96.         End Sub
  97.     End Structure
  98.  
  99.     Private F1, F2, F3, F4 As Boolean, PTC As Point
  100.     Private Function GetPointer() As Pointer
  101.         PTC = PointToClient(MousePosition)
  102.         F1 = PTC.X < 7
  103.         F2 = PTC.X > Width - 7
  104.         F3 = PTC.Y < 7
  105.         F4 = PTC.Y > Height - 7
  106.  
  107.         If F1 And F3 Then Return New Pointer(Cursors.SizeNWSE, 13)
  108.         If F1 And F4 Then Return New Pointer(Cursors.SizeNESW, 16)
  109.         If F2 And F3 Then Return New Pointer(Cursors.SizeNESW, 14)
  110.         If F2 And F4 Then Return New Pointer(Cursors.SizeNWSE, 17)
  111.         If F1 Then Return New Pointer(Cursors.SizeWE, 10)
  112.         If F2 Then Return New Pointer(Cursors.SizeWE, 11)
  113.         If F3 Then Return New Pointer(Cursors.SizeNS, 12)
  114.         If F4 Then Return New Pointer(Cursors.SizeNS, 15)
  115.         Return New Pointer(Cursors.Default, 0)
  116.     End Function
  117.  
  118.     Private Current, Pending As Pointer
  119.     Private Sub SetCurrent()
  120.         Pending = GetPointer()
  121.         If Current.Position = Pending.Position Then Return
  122.         Current = GetPointer()
  123.         Cursor = Current.Cursor
  124.     End Sub
  125.  
  126.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  127.         If _Resizable Then SetCurrent()
  128.         MyBase.OnMouseMove(e)
  129.     End Sub
  130.  
  131.     Protected Header As Rectangle
  132.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  133.         If Width = 0 OrElse Height = 0 Then Return
  134.         Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  135.         Invalidate()
  136.         MyBase.OnSizeChanged(e)
  137.     End Sub
  138.  
  139. #End Region
  140.  
  141. #Region " Convienence "
  142.  
  143.     MustOverride Sub PaintHook()
  144.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  145.         If Width = 0 OrElse Height = 0 Then Return
  146.         G = e.Graphics
  147.         PaintHook()
  148.     End Sub
  149.  
  150.     Private _TransparencyKey As Color
  151.     Property TransparencyKey() As Color
  152.         Get
  153.             Return _TransparencyKey
  154.         End Get
  155.         Set(ByVal v As Color)
  156.             _TransparencyKey = v
  157.             Invalidate()
  158.         End Set
  159.     End Property
  160.  
  161.     Private _Image As Image
  162.     Property Image() As Image
  163.         Get
  164.             Return _Image
  165.         End Get
  166.         Set(ByVal value As Image)
  167.             _Image = value
  168.             Invalidate()
  169.         End Set
  170.     End Property
  171.     ReadOnly Property ImageWidth() As Integer
  172.         Get
  173.             If _Image Is Nothing Then Return 0
  174.             Return _Image.Width
  175.         End Get
  176.     End Property
  177.  
  178.     Private _Size As Size
  179.     Private _Rectangle As Rectangle
  180.     Private _Gradient As LinearGradientBrush
  181.     Private _Brush As SolidBrush
  182.  
  183.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  184.         _Brush = New SolidBrush(c)
  185.         G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1)
  186.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1)
  187.         G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1)
  188.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1)
  189.     End Sub
  190.  
  191.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  192.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  193.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  194.     End Sub
  195.  
  196.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  197.         DrawText(a, c, x, 0)
  198.     End Sub
  199.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  200.         If String.IsNullOrEmpty(Text) Then Return
  201.         _Size = G.MeasureString(Text, Font).ToSize
  202.         _Brush = New SolidBrush(c)
  203.  
  204.         Select Case a
  205.             Case HorizontalAlignment.Left
  206.                 G.DrawString(Text, Font, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  207.             Case HorizontalAlignment.Right
  208.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  209.             Case HorizontalAlignment.Center
  210.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  211.         End Select
  212.     End Sub
  213.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer, ByVal f As Font)
  214.         If String.IsNullOrEmpty(Text) Then Return
  215.         _Size = G.MeasureString(Text, Font).ToSize
  216.         _Brush = New SolidBrush(c)
  217.  
  218.         Select Case a
  219.             Case HorizontalAlignment.Left
  220.                 G.DrawString(Text, f, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  221.             Case HorizontalAlignment.Right
  222.                 G.DrawString(Text, f, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  223.             Case HorizontalAlignment.Center
  224.                 G.DrawString(Text, f, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  225.         End Select
  226.     End Sub
  227.  
  228.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  229.         DrawIcon(a, x, 0)
  230.     End Sub
  231.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  232.         If _Image Is Nothing Then Return
  233.         Select Case a
  234.             Case HorizontalAlignment.Left
  235.                 G.DrawImage(_Image, x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  236.             Case HorizontalAlignment.Right
  237.                 G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  238.             Case HorizontalAlignment.Center
  239.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, _MoveHeight \ 2 - _Image.Height \ 2)
  240.         End Select
  241.     End Sub
  242.  
  243.     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)
  244.         _Rectangle = New Rectangle(x, y, width, height)
  245.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  246.         G.FillRectangle(_Gradient, _Rectangle)
  247.     End Sub
  248.  
  249. #End Region
  250.  
  251. End Class
  252. MustInherit Class ThemeControl
  253.     Inherits Control
  254.  
  255. #Region " Initialization "
  256.  
  257.     Protected G As Graphics, B As Bitmap
  258.     Sub New()
  259.         SetStyle(DirectCast(139270, ControlStyles), True)
  260.         B = New Bitmap(1, 1)
  261.         G = Graphics.FromImage(B)
  262.     End Sub
  263.  
  264.     Sub AllowTransparent()
  265.         SetStyle(ControlStyles.Opaque, False)
  266.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  267.     End Sub
  268.  
  269.     Overrides Property Text As String
  270.         Get
  271.             Return MyBase.Text
  272.         End Get
  273.         Set(ByVal v As String)
  274.             MyBase.Text = v
  275.             Invalidate()
  276.         End Set
  277.     End Property
  278. #End Region
  279.  
  280. #Region " Mouse Handling "
  281.  
  282.     Protected Enum State As Byte
  283.         MouseNone = 0
  284.         MouseOver = 1
  285.         MouseDown = 2
  286.     End Enum
  287.  
  288.     Protected MouseState As State
  289.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  290.         ChangeMouseState(State.MouseNone)
  291.         MyBase.OnMouseLeave(e)
  292.     End Sub
  293.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  294.         ChangeMouseState(State.MouseOver)
  295.         MyBase.OnMouseEnter(e)
  296.     End Sub
  297.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  298.         ChangeMouseState(State.MouseOver)
  299.         MyBase.OnMouseUp(e)
  300.     End Sub
  301.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  302.         If e.Button = MouseButtons.Left Then ChangeMouseState(State.MouseDown)
  303.         MyBase.OnMouseDown(e)
  304.     End Sub
  305.  
  306.     Private Sub ChangeMouseState(ByVal e As State)
  307.         MouseState = e
  308.         Invalidate()
  309.     End Sub
  310.  
  311. #End Region
  312.  
  313. #Region " Convienence "
  314.  
  315.     MustOverride Sub PaintHook()
  316.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  317.         If Width = 0 OrElse Height = 0 Then Return
  318.         PaintHook()
  319.         e.Graphics.DrawImage(B, 0, 0)
  320.     End Sub
  321.  
  322.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  323.         If Not Width = 0 AndAlso Not Height = 0 Then
  324.             B = New Bitmap(Width, Height)
  325.             G = Graphics.FromImage(B)
  326.             Invalidate()
  327.         End If
  328.         MyBase.OnSizeChanged(e)
  329.     End Sub
  330.  
  331.     Private _NoRounding As Boolean
  332.     Property NoRounding() As Boolean
  333.         Get
  334.             Return _NoRounding
  335.         End Get
  336.         Set(ByVal v As Boolean)
  337.             _NoRounding = v
  338.             Invalidate()
  339.         End Set
  340.     End Property
  341.  
  342.     Private _Image As Image
  343.     Property Image() As Image
  344.         Get
  345.             Return _Image
  346.         End Get
  347.         Set(ByVal value As Image)
  348.             _Image = value
  349.             Invalidate()
  350.         End Set
  351.     End Property
  352.     ReadOnly Property ImageWidth() As Integer
  353.         Get
  354.             If _Image Is Nothing Then Return 0
  355.             Return _Image.Width
  356.         End Get
  357.     End Property
  358.     ReadOnly Property ImageTop() As Integer
  359.         Get
  360.             If _Image Is Nothing Then Return 0
  361.             Return Height \ 2 - _Image.Height \ 2
  362.         End Get
  363.     End Property
  364.  
  365.     Private _Size As Size
  366.     Private _Rectangle As Rectangle
  367.     Private _Gradient As LinearGradientBrush
  368.     Private _Brush As SolidBrush
  369.  
  370.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  371.         If _NoRounding Then Return
  372.  
  373.         B.SetPixel(rect.X, rect.Y, c)
  374.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  375.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  376.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  377.     End Sub
  378.  
  379.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  380.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  381.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  382.     End Sub
  383.  
  384.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  385.         DrawText(a, c, x, 0)
  386.     End Sub
  387.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  388.         If String.IsNullOrEmpty(Text) Then Return
  389.         _Size = G.MeasureString(Text, Font).ToSize
  390.         _Brush = New SolidBrush(c)
  391.  
  392.         Select Case a
  393.             Case HorizontalAlignment.Left
  394.                 G.DrawString(Text, Font, _Brush, x, Height \ 2 - _Size.Height \ 2 + y)
  395.             Case HorizontalAlignment.Right
  396.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height \ 2 - _Size.Height \ 2 + y)
  397.             Case HorizontalAlignment.Center
  398.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, Height \ 2 - _Size.Height \ 2 + y)
  399.         End Select
  400.     End Sub
  401.  
  402.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  403.         DrawIcon(a, x, 0)
  404.     End Sub
  405.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  406.         If _Image Is Nothing Then Return
  407.         Select Case a
  408.             Case HorizontalAlignment.Left
  409.                 G.DrawImage(_Image, x, Height \ 2 - _Image.Height \ 2 + y)
  410.             Case HorizontalAlignment.Right
  411.                 G.DrawImage(_Image, Width - _Image.Width - x, Height \ 2 - _Image.Height \ 2 + y)
  412.             Case HorizontalAlignment.Center
  413.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, Height \ 2 - _Image.Height \ 2)
  414.         End Select
  415.     End Sub
  416.  
  417.     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)
  418.         _Rectangle = New Rectangle(x, y, width, height)
  419.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  420.         G.FillRectangle(_Gradient, _Rectangle)
  421.     End Sub
  422. #End Region
  423.  
  424. End Class
  425. MustInherit Class ThemeContainerControl
  426.     Inherits ContainerControl
  427.  
  428. #Region " Initialization "
  429.  
  430.     Protected G As Graphics, B As Bitmap
  431.     Sub New()
  432.         SetStyle(DirectCast(139270, ControlStyles), True)
  433.         B = New Bitmap(1, 1)
  434.         G = Graphics.FromImage(B)
  435.     End Sub
  436.  
  437.     Sub AllowTransparent()
  438.         SetStyle(ControlStyles.Opaque, False)
  439.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  440.     End Sub
  441.  
  442. #End Region
  443.  
  444. #Region " Convienence "
  445.  
  446.     MustOverride Sub PaintHook()
  447.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  448.         If Width = 0 OrElse Height = 0 Then Return
  449.         PaintHook()
  450.         e.Graphics.DrawImage(B, 0, 0)
  451.     End Sub
  452.  
  453.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  454.         If Not Width = 0 AndAlso Not Height = 0 Then
  455.             B = New Bitmap(Width, Height)
  456.             G = Graphics.FromImage(B)
  457.             Invalidate()
  458.         End If
  459.         MyBase.OnSizeChanged(e)
  460.     End Sub
  461.  
  462.     Private _NoRounding As Boolean
  463.     Property NoRounding() As Boolean
  464.         Get
  465.             Return _NoRounding
  466.         End Get
  467.         Set(ByVal v As Boolean)
  468.             _NoRounding = v
  469.             Invalidate()
  470.         End Set
  471.     End Property
  472.  
  473.     Private _Rectangle As Rectangle
  474.     Private _Gradient As LinearGradientBrush
  475.  
  476.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  477.         If _NoRounding Then Return
  478.         B.SetPixel(rect.X, rect.Y, c)
  479.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  480.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  481.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  482.     End Sub
  483.  
  484.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  485.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  486.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  487.     End Sub
  488.  
  489.     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)
  490.         _Rectangle = New Rectangle(x, y, width, height)
  491.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  492.         G.FillRectangle(_Gradient, _Rectangle)
  493.     End Sub
  494. #End Region
  495.  
  496. End Class
  497.  
  498.  
  499. Class Thief3Theme
  500.     Inherits Theme
  501.  
  502.     Private _bStripes As Boolean
  503.     Public Property HatchEnable() As Boolean
  504.         Get
  505.             Return _bStripes
  506.         End Get
  507.         Set(ByVal v As Boolean)
  508.             _bStripes = v
  509.             Invalidate()
  510.         End Set
  511.     End Property
  512.     Private _aColor As Color
  513.     Public Property AccentColor() As Color
  514.         Get
  515.             Return _aColor
  516.         End Get
  517.         Set(ByVal value As Color)
  518.             _aColor = value
  519.             Invalidate()
  520.         End Set
  521.     End Property
  522.     Private _cStyle As Boolean
  523.     Public Property DarkTheme() As Boolean
  524.         Get
  525.             Return _cStyle
  526.         End Get
  527.         Set(ByVal v As Boolean)
  528.             _cStyle = v
  529.             Invalidate()
  530.         End Set
  531.     End Property
  532.     Private _tAlign As HorizontalAlignment
  533.     Public Property TitleTextAlign() As HorizontalAlignment
  534.         Get
  535.             Return _tAlign
  536.         End Get
  537.         Set(ByVal v As HorizontalAlignment)
  538.             _tAlign = v
  539.             Invalidate()
  540.         End Set
  541.     End Property
  542.     Sub New()
  543.         MoveHeight = 19
  544.         TransparencyKey = Color.Fuchsia
  545.         Me.Resizable = False
  546.         Me.Font = New Font("Microsoft Sans Serif", 9, FontStyle.Regular)
  547.         'Custom Settings
  548.        HatchEnable = True
  549.         AccentColor = Color.DodgerBlue
  550.         DarkTheme = True
  551.         TitleTextAlign = Left
  552.     End Sub
  553.     Public Overrides Sub PaintHook()
  554.         Dim ClientPtA, ClientPtB, GradA, GradB As Integer
  555.         Dim PenColor As Pen
  556.         Select Case HatchEnable
  557.             Case True
  558.                 ClientPtA = 38
  559.                 ClientPtB = 37
  560.             Case False
  561.                 ClientPtA = 21
  562.                 ClientPtB = -1
  563.         End Select
  564.         Select Case DarkTheme
  565.             Case True
  566.                 GradA = 51
  567.                 GradB = 30
  568.                 PenColor = Pens.Black
  569.             Case False
  570.                 GradA = 200
  571.                 GradB = 160
  572.                 PenColor = Pens.DimGray
  573.         End Select
  574.         G.Clear(Color.FromArgb(GradA, GradA, GradA))
  575.         DrawGradient(Color.FromArgb(GradA, GradA, GradA), Color.FromArgb(GradB, GradB, GradB), 0, 0, Width, 19, 90S)
  576.         Select Case HatchEnable
  577.             Case True
  578.                 DrawGradient(Color.FromArgb(GradB, GradB, GradB), Color.FromArgb(GradA, GradA, GradA), 0, 19, Width, 18, 90S)
  579.         End Select
  580.         G.DrawLine(PenColor, 0, 20, Width, 20)
  581.         G.DrawLine(PenColor, 0, ClientPtB, Width, ClientPtB)
  582.         Select Case HatchEnable
  583.             Case True
  584.                 For I As Integer = 0 To Width + 17 Step 4
  585.                     G.DrawLine(PenColor, I, 21, I - 17, ClientPtA)
  586.                     G.DrawLine(PenColor, I - 1, 21, I - 18, ClientPtA)
  587.                 Next
  588.         End Select
  589.         G.DrawLine(New Pen(New SolidBrush(AccentColor)), 0, ClientPtA, Width, ClientPtA)
  590.         G.DrawLine(New Pen(New SolidBrush(AccentColor)), 0, Height - 2, Width, Height - 2)
  591.         G.DrawLine(New Pen(New SolidBrush(AccentColor)), 1, ClientPtA, 1, Height - 2)
  592.         G.DrawLine(New Pen(New SolidBrush(AccentColor)), Width - 2, ClientPtA, Width - 2, Height - 1)
  593.         G.DrawString(".", Me.Parent.Font, Brushes.Black, -2, Height - 12)
  594.         G.DrawString(".", Me.Parent.Font, Brushes.Black, Width - 5, Height - 12)
  595.         DrawText(TitleTextAlign, AccentColor, 6, 0)
  596.         DrawBorders(Pens.Black, Pens.Transparent, ClientRectangle)
  597.         DrawCorners(Color.Fuchsia, ClientRectangle)
  598.     End Sub
  599.  
  600. End Class
  601. Class Thief3TopButton
  602.     Inherits ThemeControl
  603.     Private _aColor As Color
  604.     Public Property AccentColor() As Color
  605.         Get
  606.             Return _aColor
  607.         End Get
  608.         Set(ByVal value As Color)
  609.             _aColor = value
  610.             Invalidate()
  611.         End Set
  612.     End Property
  613.     Private _cStyle As Boolean
  614.     Public Property DarkTheme() As Boolean
  615.         Get
  616.             Return _cStyle
  617.         End Get
  618.         Set(ByVal v As Boolean)
  619.             _cStyle = v
  620.             Invalidate()
  621.         End Set
  622.     End Property
  623.     Sub New()
  624.         Size = New Size(11, 5)
  625.         AccentColor = Color.DodgerBlue
  626.         DarkTheme = True
  627.     End Sub
  628.     Overrides Sub PaintHook()
  629.         G.Clear(Color.FromArgb(102, 102, 102))
  630.         Dim GradA, GradB, GradC As Integer
  631.         Select Case DarkTheme
  632.             Case True
  633.                 GradA = 61
  634.                 GradB = 49
  635.                 GradC = 51
  636.             Case False
  637.                 GradA = 200
  638.                 GradB = 155
  639.                 GradC = 155
  640.         End Select
  641.         Select Case MouseState
  642.             Case State.MouseNone
  643.                 DrawGradient(Color.FromArgb(GradA, GradA, GradA), Color.FromArgb(GradB, GradB, GradB), 0, 0, Width, Height, 90S)
  644.             Case State.MouseOver
  645.                 DrawGradient(Color.FromArgb(GradA, GradA, GradA), Color.FromArgb(GradB, GradB, GradB), 0, 0, Width, Height, 90S)
  646.             Case State.MouseDown
  647.                 DrawGradient(Color.FromArgb(GradB, GradB, GradB), Color.FromArgb(GradA, GradA, GradA), 0, 0, Width, Height, 90S)
  648.         End Select
  649.         DrawBorders(New Pen(New SolidBrush(AccentColor)), Pens.Transparent, ClientRectangle)
  650.         DrawCorners(Color.FromArgb(GradC, GradC, GradC), ClientRectangle)
  651.     End Sub
  652. End Class
  653. Class Thief3Button
  654.     Inherits ThemeControl
  655.     Private _aColor As Color
  656.     Public Property AccentColor() As Color
  657.         Get
  658.             Return _aColor
  659.         End Get
  660.         Set(ByVal value As Color)
  661.             _aColor = value
  662.             Invalidate()
  663.         End Set
  664.     End Property
  665.     Private _cStyle As Boolean
  666.     Public Property DarkTheme() As Boolean
  667.         Get
  668.             Return _cStyle
  669.         End Get
  670.         Set(ByVal v As Boolean)
  671.             _cStyle = v
  672.             Invalidate()
  673.         End Set
  674.     End Property
  675.     Sub New()
  676.         Select Case DarkTheme
  677.             Case True
  678.                 BackColor = Color.FromArgb(51, 51, 51)
  679.             Case False
  680.                 BackColor = Color.FromArgb(200, 200, 200)
  681.         End Select
  682.         AccentColor = Color.DodgerBlue
  683.     End Sub
  684.     Overrides Sub PaintHook()
  685.         Dim GradA, GradB As Integer
  686.         Dim PenColor As Pen
  687.         Select Case DarkTheme
  688.             Case True
  689.                 GradA = 61
  690.                 GradB = 49
  691.                 PenColor = Pens.DimGray
  692.             Case False
  693.                 GradA = 200
  694.                 GradB = 155
  695.                 PenColor = Pens.White
  696.         End Select
  697.         G.Clear(Color.FromArgb(102, 102, 102))
  698.         Select Case MouseState
  699.             Case State.MouseNone
  700.                 DrawGradient(Color.FromArgb(GradA, GradA, GradA), Color.FromArgb(GradB, GradB, GradB), 0, 0, Width, Height, 90S)
  701.                 G.DrawLine(PenColor, 1, 1, Width - 1, 1)
  702.             Case State.MouseOver
  703.                 DrawGradient(Color.FromArgb(GradA, GradA, GradA), Color.FromArgb(GradB, GradB, GradB), 0, 0, Width, Height, 90S)
  704.                 G.DrawLine(PenColor, 1, 1, Width - 1, 1)
  705.             Case State.MouseDown
  706.                 DrawGradient(Color.FromArgb(GradB, GradB, GradB), Color.FromArgb(GradA, GradA, GradA), 0, 0, Width, Height, 90S)
  707.                 G.DrawLine(PenColor, 1, Height - 2, Width - 1, Height - 2)
  708.         End Select
  709.         DrawBorders(Pens.Black, Pens.Transparent, ClientRectangle)
  710.         DrawText(HorizontalAlignment.Center, AccentColor, -1, 0)
  711.     End Sub
  712. End Class
  713. Class Thief3Check
  714.     Inherits ThemeControl
  715.     Private _cStyle As Boolean
  716.     Public Property DarkTheme() As Boolean
  717.         Get
  718.             Return _cStyle
  719.         End Get
  720.         Set(ByVal v As Boolean)
  721.             _cStyle = v
  722.             Invalidate()
  723.         End Set
  724.     End Property
  725.     Private _CheckedState As Boolean
  726.     Public Property CheckedState() As Boolean
  727.         Get
  728.             Return _CheckedState
  729.         End Get
  730.         Set(ByVal v As Boolean)
  731.             _CheckedState = v
  732.             Invalidate()
  733.         End Set
  734.     End Property
  735.     Sub New()
  736.         Size = New Size(90, 15)
  737.         MinimumSize = New Size(16, 16)
  738.         MaximumSize = New Size(600, 16)
  739.  
  740.         DarkTheme = True
  741.         CheckedState = False
  742.     End Sub
  743.     Public Overrides Sub PaintHook()
  744.         Dim Grad As Integer
  745.         Dim FontColor As Color
  746.         Select Case DarkTheme
  747.             Case True
  748.                 Grad = 51
  749.                 FontColor = Color.White
  750.             Case False
  751.                 Grad = 200
  752.                 FontColor = Color.Black
  753.         End Select
  754.         G.Clear(Color.FromArgb(Grad, Grad, Grad))
  755.         Select Case CheckedState
  756.             Case True
  757.                 'DrawGradient(Color.FromArgb(62, 62, 62), Color.FromArgb(38, 38, 38), 0, 0, 15, 15, 90S)
  758.                DrawGradient(Color.FromArgb(132, 192, 240), Color.FromArgb(78, 123, 168), 3, 3, 9, 9, 90S)
  759.                 DrawGradient(Color.FromArgb(98, 159, 220), Color.FromArgb(62, 102, 147), 4, 4, 7, 7, 90S)
  760.             Case False
  761.                 DrawGradient(Color.FromArgb(80, 80, 80), Color.FromArgb(80, 80, 80), 0, 0, 15, 15, 90S)
  762.         End Select
  763.         G.DrawRectangle(Pens.Black, 0, 0, 14, 14)
  764.         G.DrawRectangle(Pens.DimGray, 1, 1, 12, 12)
  765.         DrawText(HorizontalAlignment.Left, FontColor, 17, 0)
  766.     End Sub
  767.     Sub changeCheck() Handles Me.Click
  768.         Select Case CheckedState
  769.             Case True
  770.                 CheckedState = False
  771.             Case False
  772.                 CheckedState = True
  773.         End Select
  774.     End Sub
  775. End Class
  776. Class Thief3ProgressBar
  777.     Inherits ThemeControl
  778.     Private _Maximum As Integer
  779.     Public Property Maximum() As Integer
  780.         Get
  781.             Return _Maximum
  782.         End Get
  783.         Set(ByVal v As Integer)
  784.             Select Case v
  785.                 Case Is < _Value
  786.                     _Value = v
  787.             End Select
  788.             _Maximum = v
  789.             Invalidate()
  790.         End Set
  791.     End Property
  792.     Private _Value As Integer
  793.     Public Property Value() As Integer
  794.         Get
  795.             Select Case _Value
  796.                 Case 0
  797.                     Return 1
  798.                 Case Else
  799.                     Return _Value
  800.             End Select
  801.         End Get
  802.         Set(ByVal v As Integer)
  803.             Select Case v
  804.                 Case Is > _Maximum
  805.                     v = _Maximum
  806.             End Select
  807.             _Value = v
  808.             Invalidate()
  809.         End Set
  810.     End Property
  811.     Overrides Sub PaintHook()
  812.         G.Clear(Color.FromArgb(51, 51, 51))
  813.         'Fill
  814.        Select Case _Value
  815.             Case Is > 2
  816.                 DrawGradient(Color.FromArgb(132, 192, 240), Color.FromArgb(78, 123, 168), 3, 3, CInt(_Value / _Maximum * Width) - 6, Height - 6, 90S)
  817.                 DrawGradient(Color.FromArgb(98, 159, 220), Color.FromArgb(62, 102, 147), 4, 4, CInt(_Value / _Maximum * Width) - 8, Height - 8, 90S)
  818.             Case Is > 0
  819.                 DrawGradient(Color.FromArgb(132, 192, 240), Color.FromArgb(78, 123, 168), 3, 3, CInt(_Value / _Maximum * Width), Height - 6, 90S)
  820.                 DrawGradient(Color.FromArgb(98, 159, 220), Color.FromArgb(62, 102, 147), 4, 4, CInt(_Value / _Maximum * Width) - 2, Height - 8, 90S)
  821.         End Select
  822.  
  823.         'Borders
  824.        G.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1)
  825.         G.DrawRectangle(Pens.Gray, 1, 1, Width - 3, Height - 3)
  826.     End Sub
  827. End Class
Add Comment
Please, Sign In to add comment