Option Strict On
Imports System.Drawing.Drawing2D
'<info>
' --------------------Unique Theme--------------------
' Creator - SaketSaket (HF)
' UID - 1869668
' Inspiration & Credits to all Theme creaters of HF
' Version - 1.0
' Date Created - 1st August 2014
' Date Modified - 4th August 2014
'
'
'Special Thanks to Aeonhack for RoundRect Functions...
'Theme container inspiration taken from Mephobia's Perplex Theme
'
'
' For bugs & Constructive Criticism contact me on HF
' If you like it & want to donate then pm me on HF
' --------------------Unique Theme--------------------
'<info>
'Please Leave Credits in Source, Do not redistribute
Enum MouseState As Byte
None = 0
Over = 1
Down = 2
End Enum
Module Draw
'Special Thanks to Aeonhack for RoundRect Functions... ;)
Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
Dim p As GraphicsPath = New GraphicsPath()
Dim arcRectangleWidth As Integer = curve * 2
p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
Return p
End Function
Public Function RoundRect(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal curve As Integer) As GraphicsPath
Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
Dim p As GraphicsPath = New GraphicsPath()
Dim arcRectangleWidth As Integer = curve * 2
p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
Return p
End Function
End Module
Public Class UniqueTheme : Inherits ContainerControl
Dim WithEvents _mytimer As Windows.Forms.Timer
Dim _myval As Integer = 0
Private _mousepos As Point = New Point(0, 0)
Private _drag As Boolean = False
Private _icon As Icon
Public Property Icon() As Icon
Get
Return _icon
End Get
Set(ByVal value As Icon)
_icon = value
Invalidate()
End Set
End Property
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
MyBase.OnMouseDown(e)
If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(55, 1, Width - 180, 35).Contains(e.Location) Then
_drag = True : _mousepos = e.Location
End If
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e)
_drag = False
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
MyBase.OnMouseMove(e)
If _drag Then
Parent.Location = New Point(MousePosition.X - _mousepos.X, MousePosition.Y - _mousepos.Y)
End If
End Sub
Protected Overrides Sub OnResize(ByVal e As EventArgs)
MyBase.OnResize(e)
Invalidate()
End Sub
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.FromArgb(32, 32, 32)
DoubleBuffered = True
_mytimer = New Timer()
_mytimer.Interval = 1000
End Sub
Protected Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
ParentForm.FormBorderStyle = FormBorderStyle.None
ParentForm.TransparencyKey = Color.Fuchsia
Dock = DockStyle.Fill
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim outerrect As Rectangle = New Rectangle(7, 18, Width - 15, Height - 19)
Dim innerrect As Rectangle = New Rectangle(11, 22, Width - 23, Height - 27)
Dim headleftrecct As Rectangle = New Rectangle(1, 1, 35, 35)
Dim headcenterrect As Rectangle = New Rectangle(55, 1, Width - 180, 35)
Dim headrightrecct As Rectangle = New Rectangle(Width - 105, 1, 100, 35)
MyBase.OnPaint(e)
g.Clear(Color.Fuchsia)
g.FillPath(New SolidBrush(Color.FromArgb(89, 87, 85)), RoundRect(outerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(outerrect, 3))
g.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(innerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(innerrect, 3))
Dim leftheader As New LinearGradientBrush(headleftrecct, Color.FromArgb(56, 68, 85), Color.FromArgb(41, 42, 46), LinearGradientMode.Vertical)
g.FillPath(leftheader, RoundRect(headleftrecct, 4))
g.DrawPath(New Pen(Brushes.Black), RoundRect(headleftrecct, 4))
Dim centerheader As New LinearGradientBrush(headcenterrect, Color.FromArgb(56, 68, 85), Color.FromArgb(41, 42, 46), LinearGradientMode.Vertical)
g.FillPath(centerheader, RoundRect(headcenterrect, 4))
g.DrawPath(New Pen(Brushes.Black), RoundRect(headcenterrect, 4))
Dim rightheader As New LinearGradientBrush(headcenterrect, Color.FromArgb(56, 68, 85), Color.FromArgb(41, 42, 46), LinearGradientMode.Vertical)
g.FillPath(rightheader, RoundRect(headrightrecct, 4))
g.DrawPath(New Pen(Brushes.Black), RoundRect(headrightrecct, 4))
Try
g.DrawIcon(_icon, New Rectangle(6, 6, 26, 26))
Catch : End Try
If _myval = 0 Then
g.DrawString(Text, New Font("Verdana", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(180, 180, 180)), headcenterrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
ElseIf _myval = 1 Then
g.DrawString(Text, New Font("Verdana", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(255, 255, 255)), headcenterrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End If
If Not DesignMode Then _mytimer.Start()
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
Private Sub MyTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles _mytimer.Tick
If _myval = 0 Then
_myval = 1
Else
_myval = 0
End If
Invalidate()
End Sub
End Class
Public Class UniqueControlBox : Inherits Control
Dim _state As MouseState = MouseState.None
Dim _x As Integer
ReadOnly _minrect As New Rectangle(5, 2, 24, 24)
ReadOnly _maxrect As New Rectangle(32, 2, 24, 24)
ReadOnly _closerect As New Rectangle(59, 2, 24, 24)
Private _minDisable As Boolean = False
Public Property MinimumDisable As Boolean
Get
Return _minDisable
End Get
Set(value As Boolean)
_minDisable = value
Invalidate()
End Set
End Property
Private _maxDisable As Boolean = False
Public Property MaximumDisable As Boolean
Get
Return _maxDisable
End Get
Set(value As Boolean)
_maxDisable = value
Invalidate()
End Set
End Property
Protected Overrides Sub OnMouseDown(ByVal e As Windows.Forms.MouseEventArgs)
MyBase.OnMouseDown(e)
If _x > 5 AndAlso _x < 29 Then
If MinimumDisable = False Then
FindForm.WindowState = FormWindowState.Minimized
End If
ElseIf _x > 32 AndAlso _x < 56 Then
If MaximumDisable = False Then
If FindForm.WindowState = FormWindowState.Maximized Then
FindForm.WindowState = FormWindowState.Minimized
FindForm.WindowState = FormWindowState.Normal
Else
FindForm.WindowState = FormWindowState.Minimized
FindForm.WindowState = FormWindowState.Maximized
End If
End If
ElseIf _x > 59 AndAlso _x < 83 Then
FindForm.Close()
End If
_state = MouseState.Down : Invalidate()
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As Windows.Forms.MouseEventArgs)
MyBase.OnMouseUp(e)
_state = MouseState.Over : Invalidate()
End Sub
Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
MyBase.OnMouseEnter(e)
_state = MouseState.Over : Invalidate()
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
MyBase.OnMouseLeave(e)
_state = MouseState.None : Invalidate()
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As Windows.Forms.MouseEventArgs)
MyBase.OnMouseMove(e)
_x = e.Location.X
Invalidate()
End Sub
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = Color.Transparent
Width = 85
Height = 30
Anchor = AnchorStyles.Top Or AnchorStyles.Right
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
Dim minrdefault As New LinearGradientBrush(_minrect, Color.FromArgb(89, 87, 85), Color.FromArgb(52, 52, 52), 90S)
g.FillEllipse(minrdefault, _minrect)
g.DrawEllipse(Pens.DimGray, _minrect)
Dim maxrdefault As New LinearGradientBrush(_maxrect, Color.FromArgb(89, 87, 85), Color.FromArgb(52, 52, 52), 90S)
g.FillEllipse(maxrdefault, _maxrect)
g.DrawEllipse(Pens.DimGray, _maxrect)
Dim crdefault As New LinearGradientBrush(_closerect, Color.FromArgb(89, 87, 85), Color.FromArgb(52, 52, 52), 90S)
g.FillEllipse(crdefault, _closerect)
g.DrawEllipse(Pens.DimGray, _closerect)
Select Case _state
Case MouseState.None
Dim minrnone As New LinearGradientBrush(_minrect, Color.FromArgb(89, 87, 85), Color.FromArgb(52, 52, 52), 90S)
g.FillEllipse(minrnone, _minrect)
g.DrawEllipse(Pens.DimGray, _minrect)
Dim maxrnone As New LinearGradientBrush(_maxrect, Color.FromArgb(89, 87, 85), Color.FromArgb(52, 52, 52), 90S)
g.FillEllipse(maxrnone, _maxrect)
g.DrawEllipse(Pens.DimGray, _maxrect)
Dim crnone As New LinearGradientBrush(_closerect, Color.FromArgb(89, 87, 85), Color.FromArgb(52, 52, 52), 90S)
g.FillEllipse(crnone, _closerect)
g.DrawEllipse(Pens.DimGray, _closerect)
Case MouseState.Over
If _x > 5 AndAlso _x < 29 Then
If MinimumDisable = False Then
Dim minrover As New LinearGradientBrush(_minrect, Color.FromArgb(109, 107, 105), Color.FromArgb(72, 72, 72), 90S)
g.FillEllipse(minrover, _minrect)
g.DrawEllipse(Pens.DimGray, _minrect)
End If
ElseIf _x > 32 AndAlso _x < 56 Then
If MaximumDisable = False Then
Dim maxrover As New LinearGradientBrush(_maxrect, Color.FromArgb(109, 107, 105), Color.FromArgb(72, 72, 72), 90S)
g.FillEllipse(maxrover, _maxrect)
g.DrawEllipse(Pens.DimGray, _maxrect)
End If
ElseIf _x > 59 AndAlso _x < 83 Then
Dim crover As New LinearGradientBrush(_closerect, Color.FromArgb(109, 107, 105), Color.FromArgb(72, 72, 72), 90S)
g.FillEllipse(crover, _closerect)
g.DrawEllipse(Pens.DimGray, _closerect)
End If
Case Else
If MinimumDisable = False Then
Dim minrelse As New LinearGradientBrush(_minrect, Color.FromArgb(129, 127, 125), Color.FromArgb(92, 92, 92), 90S)
g.FillEllipse(minrelse, _minrect)
g.DrawEllipse(Pens.DimGray, _minrect)
End If
If MaximumDisable = False Then
Dim maxrelse As New LinearGradientBrush(_maxrect, Color.FromArgb(129, 127, 125), Color.FromArgb(92, 92, 92), 90S)
g.FillEllipse(maxrelse, _maxrect)
g.DrawEllipse(Pens.DimGray, _maxrect)
End If
Dim crelse As New LinearGradientBrush(_closerect, Color.FromArgb(129, 127, 125), Color.FromArgb(92, 92, 92), 90S)
g.FillEllipse(crelse, _closerect)
g.DrawEllipse(Pens.DimGray, _closerect)
End Select
End Sub
End Class
Public Class UniqueRadioButton : Inherits Control
Private _check As Boolean
Public Property Checked As Boolean
Get
Return _check
End Get
Set(value As Boolean)
_check = value
Invalidate()
End Set
End Property
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
Size = New Size(180, 25)
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
MyBase.OnTextChanged(e)
Invalidate()
End Sub
Protected Overrides Sub OnClick(ByVal e As EventArgs)
MyBase.OnClick(e)
If Not Checked Then Checked = True
For Each ctrl As UniqueRadioButton In From ctrl1 In Parent.Controls.OfType(Of UniqueRadioButton)() Where ctrl1.Handle <> Handle Where ctrl1.Enabled
ctrl.Checked = False
Next
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
g.Clear(BackColor)
g.DrawString(Text, New Font("Verdana", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(12, 4, Width, 16), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Dim selectionrect As Rectangle = New Rectangle(3, 3, 17, 17)
g.DrawEllipse(New Pen(Color.FromArgb(152, 152, 152), 2), selectionrect)
If Checked Then
selectionrect.Inflate(-4, -4)
g.DrawEllipse(New Pen(Color.FromArgb(182, 182, 182), 2), selectionrect)
Else
g.DrawEllipse(New Pen(Color.FromArgb(152, 152, 152)), selectionrect)
End If
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueCheckBox : Inherits Control
Private _check As Boolean
Public Property Checked As Boolean
Get
Return _check
End Get
Set(value As Boolean)
_check = value
Invalidate()
End Set
End Property
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
Size = New Size(180, 25)
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
MyBase.OnTextChanged(e)
Invalidate()
End Sub
Protected Overrides Sub OnClick(ByVal e As EventArgs)
MyBase.OnClick(e)
If Not Checked Then Checked = True Else Checked = False
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
g.Clear(BackColor)
g.DrawString(Text, New Font("Verdana", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(12, 4, Width, 16), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Dim selectionrect As Rectangle = New Rectangle(3, 3, 17, 17)
g.DrawRectangle(New Pen(Color.FromArgb(152, 152, 152), 2), selectionrect)
If Checked Then
selectionrect.Inflate(-4, -4)
g.DrawRectangle(New Pen(Color.FromArgb(182, 182, 182), 2), selectionrect)
Else
g.DrawRectangle(New Pen(Color.FromArgb(152, 152, 152)), selectionrect)
End If
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueProgressBar : Inherits Control
Dim WithEvents _mytimer As Windows.Forms.Timer
Dim _myval As Integer = 0
Private _val As Integer
Public Property Value() As Integer
Get
Return _val
End Get
Set(ByVal v As Integer)
If v > _max Then
_val = _max
ElseIf v < 0 Then
_val = 0
Else
_val = v
End If
Invalidate()
End Set
End Property
Private _max As Integer
Public Property Maximum() As Integer
Get
Return _max
End Get
Set(ByVal v As Integer)
If v < 1 Then
_max = 1
Else
_max = v
End If
If v < _val Then
_val = _max
End If
Invalidate()
End Set
End Property
Private _showPercentage As Boolean = False
Public Property ShowPercentage() As Boolean
Get
Return _showPercentage
End Get
Set(ByVal v As Boolean)
_showPercentage = v
Invalidate()
End Set
End Property
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
Size = New Size(200, 20)
DoubleBuffered = True
_max = 100
_mytimer = New Timer()
_mytimer.Interval = 500
End Sub
Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim percent As Integer = CInt((Width - 1) * (_val / _max))
Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
Dim innerrect As Rectangle = New Rectangle(1, 1, percent - 3, Height - 3)
MyBase.OnPaint(e)
g.Clear(BackColor)
g.SmoothingMode = SmoothingMode.HighQuality
g.FillPath(New SolidBrush(Color.FromArgb(129, 127, 125)), RoundRect(outerrect, 3))
If percent <> 0 Then
Try
If _myval = 0 Then
g.FillPath(New SolidBrush(Color.FromArgb(72, 72, 72)), RoundRect(innerrect, 3))
ElseIf _myval = 1 Then
g.FillPath(New SolidBrush(Color.FromArgb(62, 62, 62)), RoundRect(innerrect, 3))
End If
Catch : End Try
End If
If Not DesignMode Then _mytimer.Start()
If _showPercentage Then
g.DrawString(String.Format("{0}%", _val), New Font("Verdana", 10, FontStyle.Regular), Brushes.White, New Rectangle(10, 1, Width - 1, Height - 1), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End If
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
Private Sub MyTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles _mytimer.Tick
If _myval = 0 Then
_myval = 1
Else
_myval = 0
End If
Invalidate()
End Sub
End Class
Public Class UniquePanel : Inherits ContainerControl
Protected Overrides Sub OnResize(ByVal e As EventArgs)
MyBase.OnResize(e)
Invalidate()
End Sub
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
Size = New Size(240, 160)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
Dim innerrect As Rectangle = New Rectangle(3, 3, Width - 7, Height - 7)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.Clear(BackColor)
g.FillPath(New SolidBrush(Color.FromArgb(89, 87, 85)), RoundRect(outerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(outerrect, 3))
g.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(innerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(innerrect, 3))
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueGroupBox : Inherits ContainerControl
Protected Overrides Sub OnResize(ByVal e As EventArgs)
MyBase.OnResize(e)
Invalidate()
End Sub
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
Size = New Size(240, 160)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
Dim innerrect As Rectangle = New Rectangle(3, 3, Width - 7, Height - 7)
Dim underlinepen As New Pen(Color.FromArgb(255, 255, 255), 2)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.Clear(BackColor)
g.FillPath(New SolidBrush(Color.FromArgb(89, 87, 85)), RoundRect(outerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(outerrect, 3))
g.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(innerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(innerrect, 3))
g.DrawString(Text, New Font("Verdana", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(0, 0, Width - 1, 30), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
g.DrawLine(underlinepen, 20, 28, Width - 21, 28)
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueButton : Inherits Control
Dim _state As MouseState
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
MyBase.OnMouseDown(e)
_state = MouseState.Down
Invalidate()
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e)
_state = MouseState.Over
Invalidate()
End Sub
Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
MyBase.OnMouseEnter(e)
_state = MouseState.Over
Invalidate()
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
MyBase.OnMouseLeave(e)
_state = MouseState.None
Invalidate()
End Sub
Sub New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
Size = New Size(150, 30)
_state = MouseState.None
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
Dim btnfont As New Font("Verdana", 10, FontStyle.Regular)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
g.Clear(BackColor)
Dim buttonrect As New LinearGradientBrush(rect, Color.FromArgb(56, 68, 85), Color.FromArgb(41, 42, 46), LinearGradientMode.Vertical)
g.FillPath(buttonrect, RoundRect(rect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(rect, 3))
Select Case _state
Case MouseState.None
Dim buttonrectnone As New LinearGradientBrush(rect, Color.FromArgb(56, 68, 85), Color.FromArgb(41, 42, 46), LinearGradientMode.Vertical)
g.FillPath(buttonrectnone, RoundRect(rect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(rect, 3))
g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Case MouseState.Down
Dim buttonrectdown As New LinearGradientBrush(rect, Color.FromArgb(76, 88, 105), Color.FromArgb(61, 62, 66), LinearGradientMode.Vertical)
g.FillPath(buttonrectdown, RoundRect(rect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(rect, 3))
g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Case MouseState.Over
Dim buttonrectover As New LinearGradientBrush(rect, Color.FromArgb(66, 78, 95), Color.FromArgb(51, 52, 56), LinearGradientMode.Vertical)
g.FillPath(buttonrectover, RoundRect(rect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(rect, 3))
g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End Select
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueTextBox : Inherits Control
Dim WithEvents _tb As New TextBox
Private _allowpassword As Boolean = False
Public Shadows Property UseSystemPasswordChar() As Boolean
Get
Return _allowpassword
End Get
Set(ByVal value As Boolean)
_tb.UseSystemPasswordChar = UseSystemPasswordChar
_allowpassword = value
Invalidate()
End Set
End Property
Private _maxChars As Integer = 32767
Public Shadows Property MaxLength() As Integer
Get
Return _maxChars
End Get
Set(ByVal value As Integer)
_maxChars = value
_tb.MaxLength = MaxLength
Invalidate()
End Set
End Property
Private _textAlignment As HorizontalAlignment
Public Shadows Property TextAlign() As HorizontalAlignment
Get
Return _textAlignment
End Get
Set(ByVal value As HorizontalAlignment)
_textAlignment = value
Invalidate()
End Set
End Property
Private _multiLine As Boolean = False
Public Shadows Property MultiLine() As Boolean
Get
Return _multiLine
End Get
Set(ByVal value As Boolean)
_multiLine = value
_tb.Multiline = value
OnResize(EventArgs.Empty)
Invalidate()
End Set
End Property
Private _readOnly As Boolean = False
Public Shadows Property [ReadOnly]() As Boolean
Get
Return _readOnly
End Get
Set(ByVal value As Boolean)
_readOnly = value
If _tb IsNot Nothing Then
_tb.ReadOnly = value
End If
End Set
End Property
Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
MyBase.OnTextChanged(e)
Invalidate()
End Sub
Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
MyBase.OnBackColorChanged(e)
Invalidate()
End Sub
Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
MyBase.OnForeColorChanged(e)
_tb.ForeColor = ForeColor
Invalidate()
End Sub
Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
MyBase.OnFontChanged(e)
_tb.Font = Font
End Sub
Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
MyBase.OnGotFocus(e)
_tb.Focus()
End Sub
Private Sub TextChangeTb() Handles _tb.TextChanged
Text = _tb.Text
End Sub
Private Sub TextChng() Handles MyBase.TextChanged
_tb.Text = Text
End Sub
Public Sub NewTextBox()
With _tb
.Text = String.Empty
.BackColor = Color.FromArgb(52, 52, 52)
.ForeColor = ForeColor
.TextAlign = HorizontalAlignment.Center
.BorderStyle = BorderStyle.None
.Location = New Point(3, 3)
.Font = New Font("Verdana", 10, FontStyle.Regular)
.Size = New Size(Width - 3, Height - 3)
.UseSystemPasswordChar = UseSystemPasswordChar
End With
End Sub
Sub New()
MyBase.New()
NewTextBox()
Controls.Add(_tb)
SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = Color.FromArgb(52, 52, 52)
ForeColor = Color.FromArgb(255, 255, 255)
Font = New Font("Verdana", 10, FontStyle.Regular)
Size = New Size(150, 30)
End Sub
Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
With _tb
.TextAlign = TextAlign
.UseSystemPasswordChar = UseSystemPasswordChar
End With
g.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(rect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(rect, 3))
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
If Not MultiLine Then
Dim tbheight As Integer = _tb.Height
_tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 1), Integer))
_tb.Size = New Size(Width - 20, tbheight)
Else
_tb.Location = New Point(10, 10)
_tb.Size = New Size(Width - 20, Height - 20)
End If
End Sub
End Class
Public Class UniqueLabel : Inherits Control
Private _border As Boolean = True
Public Property Border As Boolean
Get
Return _border
End Get
Set(value As Boolean)
_border = value
Invalidate()
End Set
End Property
Sub New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
Size = New Size(150, 30)
End Sub
Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
MyBase.OnPaint(e)
g.Clear(BackColor)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(rect, 3))
If Border = True Then
g.DrawPath(New Pen(Brushes.Black), RoundRect(rect, 3))
End If
g.DrawString(Text, New Font("Verdana", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(255, 255, 255)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueTabControl : Inherits TabControl
Sub New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
ItemSize = New Size(80, 35)
End Sub
Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
Try : SelectedTab.BackColor = Color.FromArgb(72, 72, 72) : Catch : End Try
MyBase.OnPaint(e)
g.Clear(BackColor)
g.FillRectangle(New SolidBrush(Color.FromArgb(52, 52, 52)), rect)
g.DrawRectangle(New Pen(Brushes.Black), rect)
For i = 0 To TabCount - 1
Dim textRectangle As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 5, GetTabRect(i).Location.Y + 1), New Size(GetTabRect(i).Width, GetTabRect(i).Height - 5))
If i = SelectedIndex Then
Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 3, GetTabRect(i).Location.Y + 3), New Size(GetTabRect(i).Width - 6, GetTabRect(i).Height - 9))
Dim buttonrect As New LinearGradientBrush(rect, Color.FromArgb(56, 68, 85), Color.FromArgb(41, 42, 46), 90S)
g.FillPath(buttonrect, RoundRect(tabrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 3))
g.DrawString(TabPages(i).Text, New Font("Verdana", 8, FontStyle.Bold), New SolidBrush(Color.FromArgb(255, 255, 255)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
Else
g.DrawString(TabPages(i).Text, New Font("Verdana", 8, FontStyle.Regular), New SolidBrush(Color.FromArgb(255, 255, 255)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
End If
Next
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueToggle : Inherits Control
Private _check As Boolean
Public Property Checked As Boolean
Get
Return _check
End Get
Set(value As Boolean)
_check = value
Invalidate()
End Set
End Property
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = Color.Transparent
Size = New Size(80, 25)
End Sub
Protected Overrides Sub OnClick(ByVal e As EventArgs)
MyBase.OnClick(e)
If Not Checked Then Checked = True Else Checked = False
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
MyBase.OnPaint(e)
g.Clear(BackColor)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(rect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(rect, 3))
If Checked Then
g.FillPath(New SolidBrush(Color.FromArgb(72, 72, 72)), RoundRect(New Rectangle(CInt((Width / 2) - 2), 2, CInt((Width / 2) - 1), Height - 5), 3))
g.DrawString("ON", New Font("Verdana", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(0, 5, CInt((Width / 2)), 15), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
g.DrawLine(New Pen(Color.Black), 56, 5, 56, Height - 7)
g.DrawLine(New Pen(Color.Black), 58, 3, 58, Height - 5)
g.DrawLine(New Pen(Color.Black), 60, 5, 60, Height - 7)
Else
g.FillPath(New SolidBrush(Color.FromArgb(72, 72, 72)), RoundRect(New Rectangle(2, 2, CInt((Width / 2) - 1), Height - 5), 3))
g.DrawString("OFF", New Font("Verdana", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(CInt((Width / 2)), 5, CInt((Width / 2)), 15), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
g.DrawLine(New Pen(Color.Black), 20, 5, 20, Height - 7)
g.DrawLine(New Pen(Color.Black), 22, 3, 22, Height - 5)
g.DrawLine(New Pen(Color.Black), 24, 5, 24, Height - 7)
End If
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueSeperator : Inherits Control
Enum Style
Horizontal
Verticle
End Enum
Private _alignment As Style = Style.Horizontal
Public Property Alignment As Style
Get
Return _alignment
End Get
Set(ByVal value As Style)
_alignment = value
End Set
End Property
Private _showInfo As Boolean = False
Public Property ShowInfo As Boolean
Get
Return _showInfo
End Get
Set(ByVal value As Boolean)
_showInfo = value
Invalidate()
End Set
End Property
Sub New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
BackColor = Color.Transparent
Size = New Size(40, 40)
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
MyBase.OnPaint(e)
g.Clear(BackColor)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
Select Case _alignment
Case Style.Horizontal
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(20, CType((Height / 2), Integer) - 2), New Point(Width - 20, CType((Height / 2), Integer) - 2))
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(10, CType((Height / 2), Integer) - 1), New Point(Width - 10, CType((Height / 2), Integer) - 1))
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(0, CType((Height / 2), Integer)), New Point(Width, CType((Height / 2), Integer)))
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(10, CType((Height / 2), Integer) + 1), New Point(Width - 10, CType((Height / 2), Integer) + 1))
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(20, CType((Height / 2), Integer) + 2), New Point(Width - 20, CType((Height / 2), Integer) + 2))
If ShowInfo = True Then
g.DrawString(Text, New Font("Verdana", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(0, 0, Width - 1, CType((Height / 2), Integer)), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End If
Case Style.Verticle
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(CType((Width / 2), Integer) - 2, 20), New Point(CType((Width / 2), Integer) - 2, Height - 20))
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(CType((Width / 2), Integer) - 1, 10), New Point(CType((Width / 2), Integer) - 1, Height - 10))
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(CType((Width / 2), Integer), 0), New Point(CType((Width / 2), Integer), Height))
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(CType((Width / 2), Integer) + 1, 10), New Point(CType((Width / 2), Integer) + 1, Height - 10))
g.DrawLine(New Pen(Color.FromArgb(89, 87, 85)), New Point(CType((Width / 2), Integer) + 2, 20), New Point(CType((Width / 2), Integer) + 2, Height - 20))
End Select
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class
Public Class UniqueComboBox : Inherits ComboBox
Private _startIndex As Integer = 0
Private Property StartIndex As Integer
Get
Return _startIndex
End Get
Set(ByVal value As Integer)
_startIndex = value
Try
SelectedIndex = value
Catch
End Try
Invalidate()
End Set
End Property
Sub ReplaceItem(ByVal sender As System.Object, ByVal e As Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
e.DrawBackground()
Try
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
e.Graphics.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), 3))
e.Graphics.DrawPath(New Pen(Brushes.Black), RoundRect(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), 3))
Else
e.Graphics.FillPath(New SolidBrush(Color.FromArgb(72, 72, 72)), RoundRect(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), 3))
e.Graphics.DrawPath(New Pen(Brushes.Black), RoundRect(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), 3))
End If
e.Graphics.DrawString(GetItemText(Items(e.Index)), e.Font, New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
Catch
End Try
End Sub
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
BackColor = Color.Transparent
DropDownStyle = ComboBoxStyle.DropDownList
StartIndex = 0
ItemHeight = 25
DoubleBuffered = True
Width = 200
End Sub
Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
Height = 20
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
Dim innerrect As Rectangle = New Rectangle(2, 2, Width - 5, Height - 5)
MyBase.OnPaint(e)
g.Clear(BackColor)
g.FillPath(New SolidBrush(Color.FromArgb(89, 87, 85)), RoundRect(outerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(outerrect, 3))
g.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(innerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(innerrect, 3))
g.SetClip(RoundRect(innerrect, 3))
g.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRect(innerrect, 3))
g.DrawPath(New Pen(Brushes.Black), RoundRect(innerrect, 3))
g.ResetClip()
g.DrawLine(Pens.White, Width - 9, 10, Width - 22, 10)
g.DrawLine(Pens.White, Width - 9, 11, Width - 22, 11)
g.DrawLine(Pens.White, Width - 9, 15, Width - 22, 15)
g.DrawLine(Pens.White, Width - 9, 16, Width - 22, 16)
g.DrawLine(Pens.White, Width - 9, 20, Width - 22, 20)
g.DrawLine(Pens.White, Width - 9, 21, Width - 22, 21)
g.DrawLine(New Pen(Color.FromArgb(255, 255, 255)), New Point(Width - 29, 7), New Point(Width - 29, Height - 7))
g.DrawLine(New Pen(Color.FromArgb(255, 255, 255)), New Point(Width - 30, 7), New Point(Width - 30, Height - 7))
Try
g.DrawString(Text, New Font("Verdana", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(255, 255, 255)), innerrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Catch : End Try
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class