Advertisement
benito

Untitled

Sep 7th, 2011
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 20.88 KB | None | 0 0
  1.     Imports System.Drawing.Drawing2D
  2.     Imports System.ComponentModel
  3.     Imports System.Runtime.InteropServices
  4.     MustInherit Class Theme
  5.         Inherits ContainerControl
  6.      
  7.     #Region " Initialization "
  8.      
  9.         Protected G As Graphics
  10.         Sub New()
  11.             SetStyle(DirectCast(139270, ControlStyles), True)
  12.         End Sub
  13.      
  14.         Private ParentIsForm As Boolean
  15.         Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  16.             Dock = DockStyle.Fill
  17.             ParentIsForm = TypeOf Parent Is Form
  18.             If ParentIsForm Then
  19.                 If Not _TransparencyKey = Color.Empty Then ParentForm.TransparencyKey = _TransparencyKey
  20.                 ParentForm.FormBorderStyle = FormBorderStyle.None
  21.             End If
  22.             MyBase.OnHandleCreated(e)
  23.         End Sub
  24.      
  25.         Overrides Property Text As String
  26.             Get
  27.                 Return MyBase.Text
  28.             End Get
  29.             Set(ByVal v As String)
  30.                 MyBase.Text = v
  31.                 Invalidate()
  32.             End Set
  33.         End Property
  34.     #End Region
  35.      
  36.     #Region " Sizing and Movement "
  37.      
  38.         Private _Resizable As Boolean = True
  39.         Property Resizable() As Boolean
  40.             Get
  41.                 Return _Resizable
  42.             End Get
  43.             Set(ByVal value As Boolean)
  44.                 _Resizable = value
  45.             End Set
  46.         End Property
  47.      
  48.         Private _MoveHeight As Integer = 24
  49.         Property MoveHeight() As Integer
  50.             Get
  51.                 Return _MoveHeight
  52.             End Get
  53.             Set(ByVal v As Integer)
  54.                 _MoveHeight = v
  55.                 Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  56.             End Set
  57.         End Property
  58.      
  59.         Private Flag As IntPtr
  60.         Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  61.             If Not e.Button = MouseButtons.Left Then Return
  62.             If ParentIsForm Then If ParentForm.WindowState = FormWindowState.Maximized Then Return
  63.      
  64.             If Header.Contains(e.Location) Then
  65.                 Flag = New IntPtr(2)
  66.             ElseIf Current.Position = 0 Or Not _Resizable Then
  67.                 Return
  68.             Else
  69.                 Flag = New IntPtr(Current.Position)
  70.             End If
  71.      
  72.             Capture = False
  73.             DefWndProc(Message.Create(Parent.Handle, 161, Flag, Nothing))
  74.      
  75.             MyBase.OnMouseDown(e)
  76.         End Sub
  77.      
  78.         Private Structure Pointer
  79.             ReadOnly Cursor As Cursor, Position As Byte
  80.             Sub New(ByVal c As Cursor, ByVal p As Byte)
  81.                 Cursor = c
  82.                 Position = p
  83.             End Sub
  84.         End Structure
  85.      
  86.         Private F1, F2, F3, F4 As Boolean, PTC As Point
  87.         Private Function GetPointer() As Pointer
  88.             PTC = PointToClient(MousePosition)
  89.             F1 = PTC.X < 7
  90.             F2 = PTC.X > Width - 7
  91.             F3 = PTC.Y < 7
  92.             F4 = PTC.Y > Height - 7
  93.      
  94.             If F1 And F3 Then Return New Pointer(Cursors.SizeNWSE, 13)
  95.             If F1 And F4 Then Return New Pointer(Cursors.SizeNESW, 16)
  96.             If F2 And F3 Then Return New Pointer(Cursors.SizeNESW, 14)
  97.             If F2 And F4 Then Return New Pointer(Cursors.SizeNWSE, 17)
  98.             If F1 Then Return New Pointer(Cursors.SizeWE, 10)
  99.             If F2 Then Return New Pointer(Cursors.SizeWE, 11)
  100.             If F3 Then Return New Pointer(Cursors.SizeNS, 12)
  101.             If F4 Then Return New Pointer(Cursors.SizeNS, 15)
  102.             Return New Pointer(Cursors.Default, 0)
  103.         End Function
  104.      
  105.         Private Current, Pending As Pointer
  106.         Private Sub SetCurrent()
  107.             Pending = GetPointer()
  108.             If Current.Position = Pending.Position Then Return
  109.             Current = GetPointer()
  110.             Cursor = Current.Cursor
  111.         End Sub
  112.      
  113.         Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  114.             If _Resizable Then SetCurrent()
  115.             MyBase.OnMouseMove(e)
  116.         End Sub
  117.      
  118.         Protected Header As Rectangle
  119.         Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  120.             If Width = 0 OrElse Height = 0 Then Return
  121.             Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  122.             Invalidate()
  123.             MyBase.OnSizeChanged(e)
  124.         End Sub
  125.      
  126.     #End Region
  127.      
  128.     #Region " Convienence "
  129.      
  130.         MustOverride Sub PaintHook()
  131.         Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  132.             If Width = 0 OrElse Height = 0 Then Return
  133.             G = e.Graphics
  134.             PaintHook()
  135.         End Sub
  136.      
  137.         Private _TransparencyKey As Color
  138.         Property TransparencyKey() As Color
  139.             Get
  140.                 Return _TransparencyKey
  141.             End Get
  142.             Set(ByVal v As Color)
  143.                 _TransparencyKey = v
  144.                 Invalidate()
  145.             End Set
  146.         End Property
  147.      
  148.         Private _Image As Image
  149.         Property Image() As Image
  150.             Get
  151.                 Return _Image
  152.             End Get
  153.             Set(ByVal value As Image)
  154.                 _Image = value
  155.                 Invalidate()
  156.             End Set
  157.         End Property
  158.         ReadOnly Property ImageWidth() As Integer
  159.             Get
  160.                 If _Image Is Nothing Then Return 0
  161.                 Return _Image.Width
  162.             End Get
  163.         End Property
  164.      
  165.         Private _Size As Size
  166.         Private _Rectangle As Rectangle
  167.         Private _Gradient As LinearGradientBrush
  168.         Private _Brush As SolidBrush
  169.      
  170.         Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  171.             _Brush = New SolidBrush(c)
  172.             G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1)
  173.             G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1)
  174.             G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1)
  175.             G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1)
  176.         End Sub
  177.      
  178.         Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  179.             G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  180.             G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  181.         End Sub
  182.      
  183.         Protected Sub DrawBG(ByVal c As Color, ByVal rect As Rectangle)
  184.             DrawGradient(Color.FromArgb(43, 255, 255, 255), Color.Black, 0, 0, Me.Width / 2, Me.Height / 2, 45)
  185.             DrawGradient(Color.FromArgb(43, 255, 255, 255), Color.Black, Me.Width / 2, 0, Me.Width / 2, Me.Height / 2, 135)
  186.             DrawGradient(Color.FromArgb(43, 255, 255, 255), Color.Black, 0, Me.Height / 2, Me.Width / 2, Me.Height / 2, 315)
  187.             DrawGradient(Color.FromArgb(43, 255, 255, 255), Color.Black, Me.Width / 2, Me.Height / 2, Me.Width / 2, Me.Height / 2, 225)
  188.         End Sub
  189.      
  190.         Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  191.             DrawText(a, c, x, 0)
  192.         End Sub
  193.         Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  194.             If String.IsNullOrEmpty(Text) Then Return
  195.             _Size = G.MeasureString(Text, Font).ToSize
  196.             _Brush = New SolidBrush(c)
  197.      
  198.             Select Case a
  199.                 Case HorizontalAlignment.Left
  200.                     G.DrawString(Text, Font, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  201.                 Case HorizontalAlignment.Right
  202.                     G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  203.                 Case HorizontalAlignment.Center
  204.                     G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  205.             End Select
  206.         End Sub
  207.      
  208.         Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  209.             DrawIcon(a, x, 0)
  210.         End Sub
  211.         Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  212.             If _Image Is Nothing Then Return
  213.             Select Case a
  214.                 Case HorizontalAlignment.Left
  215.                     G.DrawImage(_Image, x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  216.                 Case HorizontalAlignment.Right
  217.                     G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  218.                 Case HorizontalAlignment.Center
  219.                     G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, _MoveHeight \ 2 - _Image.Height \ 2)
  220.             End Select
  221.         End Sub
  222.      
  223.         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)
  224.             _Rectangle = New Rectangle(x, y, width, height)
  225.             _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  226.             G.FillRectangle(_Gradient, _Rectangle)
  227.         End Sub
  228.      
  229.     #End Region
  230.      
  231.     End Class
  232.     MustInherit Class ThemeControl
  233.         Inherits Control
  234.      
  235.     #Region " Initialization "
  236.      
  237.         Protected G As Graphics, B As Bitmap
  238.         Sub New()
  239.             SetStyle(DirectCast(139270, ControlStyles), True)
  240.             B = New Bitmap(1, 1)
  241.             G = Graphics.FromImage(B)
  242.         End Sub
  243.      
  244.         Sub AllowTransparent()
  245.             SetStyle(ControlStyles.Opaque, False)
  246.             SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  247.         End Sub
  248.      
  249.         Overrides Property Text As String
  250.             Get
  251.                 Return MyBase.Text
  252.             End Get
  253.             Set(ByVal v As String)
  254.                 MyBase.Text = v
  255.                 Invalidate()
  256.             End Set
  257.         End Property
  258.     #End Region
  259.      
  260.     #Region " Mouse Handling "
  261.      
  262.         Protected Enum State As Byte
  263.             MouseNone = 0
  264.             MouseOver = 1
  265.             MouseDown = 2
  266.         End Enum
  267.      
  268.         Protected MouseState As State
  269.         Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  270.             ChangeMouseState(State.MouseNone)
  271.             MyBase.OnMouseLeave(e)
  272.         End Sub
  273.         Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  274.             ChangeMouseState(State.MouseOver)
  275.             MyBase.OnMouseEnter(e)
  276.         End Sub
  277.         Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  278.             ChangeMouseState(State.MouseOver)
  279.             MyBase.OnMouseUp(e)
  280.         End Sub
  281.         Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  282.             If e.Button = MouseButtons.Left Then ChangeMouseState(State.MouseDown)
  283.             MyBase.OnMouseDown(e)
  284.         End Sub
  285.      
  286.         Private Sub ChangeMouseState(ByVal e As State)
  287.             MouseState = e
  288.             Invalidate()
  289.         End Sub
  290.      
  291.     #End Region
  292.      
  293.     #Region " Convienence "
  294.      
  295.         MustOverride Sub PaintHook()
  296.         Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  297.             If Width = 0 OrElse Height = 0 Then Return
  298.             PaintHook()
  299.             e.Graphics.DrawImage(B, 0, 0)
  300.         End Sub
  301.      
  302.         Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  303.             If Not Width = 0 AndAlso Not Height = 0 Then
  304.                 B = New Bitmap(Width, Height)
  305.                 G = Graphics.FromImage(B)
  306.                 Invalidate()
  307.             End If
  308.             MyBase.OnSizeChanged(e)
  309.         End Sub
  310.      
  311.         Private _NoRounding As Boolean
  312.         Property NoRounding() As Boolean
  313.             Get
  314.                 Return _NoRounding
  315.             End Get
  316.             Set(ByVal v As Boolean)
  317.                 _NoRounding = v
  318.                 Invalidate()
  319.             End Set
  320.         End Property
  321.      
  322.         Private _Image As Image
  323.         Property Image() As Image
  324.             Get
  325.                 Return _Image
  326.             End Get
  327.             Set(ByVal value As Image)
  328.                 _Image = value
  329.                 Invalidate()
  330.             End Set
  331.         End Property
  332.         ReadOnly Property ImageWidth() As Integer
  333.             Get
  334.                 If _Image Is Nothing Then Return 0
  335.                 Return _Image.Width
  336.             End Get
  337.         End Property
  338.         ReadOnly Property ImageTop() As Integer
  339.             Get
  340.                 If _Image Is Nothing Then Return 0
  341.                 Return Height \ 2 - _Image.Height \ 2
  342.             End Get
  343.         End Property
  344.      
  345.         Private _Size As Size
  346.         Private _Rectangle As Rectangle
  347.         Private _Gradient As LinearGradientBrush
  348.         Private _Brush As SolidBrush
  349.      
  350.         Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  351.             If _NoRounding Then Return
  352.      
  353.             B.SetPixel(rect.X, rect.Y, c)
  354.             B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  355.             B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  356.             B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  357.         End Sub
  358.      
  359.         Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  360.             G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  361.             G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  362.         End Sub
  363.      
  364.         Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  365.             DrawText(a, c, x, 0)
  366.         End Sub
  367.         Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  368.             If String.IsNullOrEmpty(Text) Then Return
  369.             _Size = G.MeasureString(Text, Font).ToSize
  370.             _Brush = New SolidBrush(c)
  371.      
  372.             Select Case a
  373.                 Case HorizontalAlignment.Left
  374.                     G.DrawString(Text, Font, _Brush, x, Height \ 2 - _Size.Height \ 2 + y)
  375.                 Case HorizontalAlignment.Right
  376.                     G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height \ 2 - _Size.Height \ 2 + y)
  377.                 Case HorizontalAlignment.Center
  378.                     G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, Height \ 2 - _Size.Height \ 2 + y)
  379.             End Select
  380.         End Sub
  381.      
  382.         Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  383.             DrawIcon(a, x, 0)
  384.         End Sub
  385.         Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  386.             If _Image Is Nothing Then Return
  387.             Select Case a
  388.                 Case HorizontalAlignment.Left
  389.                     G.DrawImage(_Image, x, Height \ 2 - _Image.Height \ 2 + y)
  390.                 Case HorizontalAlignment.Right
  391.                     G.DrawImage(_Image, Width - _Image.Width - x, Height \ 2 - _Image.Height \ 2 + y)
  392.                 Case HorizontalAlignment.Center
  393.                     G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, Height \ 2 - _Image.Height \ 2)
  394.             End Select
  395.         End Sub
  396.      
  397.         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)
  398.             _Rectangle = New Rectangle(x, y, width, height)
  399.             _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  400.             G.FillRectangle(_Gradient, _Rectangle)
  401.         End Sub
  402.     #End Region
  403.      
  404.     End Class
  405.     MustInherit Class ThemeContainerControl
  406.         Inherits ContainerControl
  407.      
  408.     #Region " Initialization "
  409.      
  410.         Protected G As Graphics, B As Bitmap
  411.         Sub New()
  412.             SetStyle(DirectCast(139270, ControlStyles), True)
  413.             B = New Bitmap(1, 1)
  414.             G = Graphics.FromImage(B)
  415.         End Sub
  416.      
  417.         Sub AllowTransparent()
  418.             SetStyle(ControlStyles.Opaque, False)
  419.             SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  420.         End Sub
  421.      
  422.     #End Region
  423.      
  424.     #Region " Convienence "
  425.      
  426.         MustOverride Sub PaintHook()
  427.         Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  428.             If Width = 0 OrElse Height = 0 Then Return
  429.             PaintHook()
  430.             e.Graphics.DrawImage(B, 0, 0)
  431.         End Sub
  432.      
  433.         Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  434.             If Not Width = 0 AndAlso Not Height = 0 Then
  435.                 B = New Bitmap(Width, Height)
  436.                 G = Graphics.FromImage(B)
  437.                 Invalidate()
  438.             End If
  439.             MyBase.OnSizeChanged(e)
  440.         End Sub
  441.      
  442.         Private _NoRounding As Boolean
  443.         Property NoRounding() As Boolean
  444.             Get
  445.                 Return _NoRounding
  446.             End Get
  447.             Set(ByVal v As Boolean)
  448.                 _NoRounding = v
  449.                 Invalidate()
  450.             End Set
  451.         End Property
  452.      
  453.         Private _Rectangle As Rectangle
  454.         Private _Gradient As LinearGradientBrush
  455.      
  456.         Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  457.             If _NoRounding Then Return
  458.             B.SetPixel(rect.X, rect.Y, c)
  459.             B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  460.             B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  461.             B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  462.         End Sub
  463.      
  464.         Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  465.             G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  466.             G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  467.         End Sub
  468.      
  469.         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)
  470.             _Rectangle = New Rectangle(x, y, width, height)
  471.             _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  472.             G.FillRectangle(_Gradient, _Rectangle)
  473.         End Sub
  474.     #End Region
  475.      
  476.     End Class
  477.      
  478.     Class InDTheme
  479.         Inherits Theme
  480.         Sub New()
  481.             Resizable = False
  482.             Font = New Font("Verdana", 8.25!)
  483.             ForeColor = Color.Black
  484.             BackColor = Color.White
  485.             TransparencyKey = Color.Fuchsia
  486.             MoveHeight = 20
  487.         End Sub
  488.         Overrides Sub PaintHook()
  489.             G.Clear(Color.Black)
  490.             DrawBG(Color.DimGray, ClientRectangle)
  491.             DrawGradient(Color.DimGray, Color.Black, 0, 0, Width, 20, 90S)
  492.             DrawCorners(Color.Fuchsia, ClientRectangle)
  493.             DrawText(HorizontalAlignment.Center, Color.White, ImageWidth)
  494.             DrawBorders(Pens.Transparent, Pens.LightGray, ClientRectangle)
  495.      
  496.         End Sub
  497.     End Class
  498.     Class InDButton
  499.         Inherits ThemeControl
  500.      
  501.         Public Overrides Sub PaintHook()
  502.             If MouseState = State.MouseDown Then
  503.                 DrawGradient(Color.DarkGray, Color.DimGray, 0, 0, Width, Height, 90S)
  504.             ElseIf MouseState = State.MouseOver Then
  505.                 DrawGradient(Color.DarkGray, Color.DarkGray, 0, 0, Width, Height, 90S)
  506.             Else
  507.                 DrawGradient(Color.DimGray, Color.DarkGray, 0, 0, Width, Height, 90S)
  508.             End If
  509.             DrawText(HorizontalAlignment.Center, ForeColor, 0)
  510.             DrawBorders(Pens.Transparent, Pens.Black, ClientRectangle)
  511.         End Sub
  512.     End Class
  513.      
  514.     Class InDProgressBar
  515.         Inherits ThemeControl
  516.      
  517.         Private _Maximum As Integer = 100
  518.         Public Property Maximum() As Integer
  519.             Get
  520.                 Return _Maximum
  521.             End Get
  522.             Set(ByVal value As Integer)
  523.                 If value < 1 Then value = 1
  524.                 If value < _Value Then _Value = value
  525.                 _Maximum = value
  526.                 Invalidate()
  527.             End Set
  528.         End Property
  529.      
  530.         Private _Value As Integer = 50
  531.         Public Property Value() As Integer
  532.             Get
  533.                 Return _Value
  534.             End Get
  535.             Set(ByVal value As Integer)
  536.                 If value > _Maximum Then value = _Maximum
  537.                 If value < 1 Then value = 1
  538.                 _Value = value
  539.                 Invalidate()
  540.             End Set
  541.         End Property
  542.      
  543.         Overrides Sub PaintHook()
  544.             G.Clear(Color.Gray)
  545.             If (_Value > 0) Then
  546.                 DrawGradient(Color.DimGray, Color.Black, 0, 0, CInt((_Value / _Maximum) * Width), Height, 90S)
  547.             End If
  548.             G.DrawRectangle(Pens.LightGray, 0, 0, Width - 1, Height - 1)
  549.             DrawBorders(Pens.White, Pens.Transparent, ClientRectangle)
  550.         End Sub
  551.     End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement