Imports System.ComponentModel Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Drawing.Text Public NotInheritable Class NetTwist Private Sub New() End Sub Friend Shared Sub DrawRoundRectangle(ByVal Graphics As Graphics, ByVal Bounds As Rectangle, ByVal Radius As Integer, ByVal Outline As Pen, ByVal Fill As LinearGradientBrush) Bounds = New Rectangle(Bounds.X, Bounds.Y, (Bounds.Width - 1), (Bounds.Height - 1)) Using Path As New GraphicsPath(FillMode.Winding) Path.AddArc(Bounds.X, Bounds.Y, Radius, Radius, 180.0F, 90.0F) Path.AddArc(Bounds.Right - Radius, Bounds.Y, Radius, Radius, 270.0F, 90.0F) Path.AddArc(Bounds.Right - Radius, Bounds.Bottom - Radius, Radius, Radius, 0.0F, 90.0F) Path.AddArc(Bounds.X, Bounds.Bottom - Radius, Radius, Radius, 90.0F, 90.0F) Path.CloseFigure() Graphics.FillPath(Fill, Path) Graphics.DrawPath(Outline, Path) End Using End Sub Friend Shared Sub DrawRoundRectangle(ByVal Graphics As Graphics, ByVal Bounds As Rectangle, ByVal Radius As Integer, ByVal Outline As Pen, ByVal Fill As Color) Bounds = New Rectangle(Bounds.X, Bounds.Y, (Bounds.Width - 1), (Bounds.Height - 1)) Using Path As New GraphicsPath(FillMode.Winding) Path.AddArc(Bounds.X, Bounds.Y, Radius, Radius, 180.0F, 90.0F) Path.AddArc(Bounds.Right - Radius, Bounds.Y, Radius, Radius, 270.0F, 90.0F) Path.AddArc(Bounds.Right - Radius, Bounds.Bottom - Radius, Radius, Radius, 0.0F, 90.0F) Path.AddArc(Bounds.X, Bounds.Bottom - Radius, Radius, Radius, 90.0F, 90.0F) Path.CloseFigure() Graphics.FillPath(New SolidBrush(Fill), Path) Graphics.DrawPath(Outline, Path) End Using End Sub Friend Shared Sub DrawCross(ByVal Graphics As Graphics, ByVal Location As Point) Using Path As New GraphicsPath() Path.AddLine(Location.X + 1, Location.Y, Location.X + 3, Location.Y) Path.AddLine(Location.X + 5, Location.Y + 2, Location.X + 7, Location.Y) Path.AddLine(Location.X + 9, Location.Y, Location.X + 10, Location.Y + 1) Path.AddLine(Location.X + 7, Location.Y + 4, Location.X + 7, Location.Y + 5) Path.AddLine(Location.X + 10, Location.Y + 8, Location.X + 9, Location.Y + 9) Path.AddLine(Location.X + 7, Location.Y + 9, Location.X + 5, Location.Y + 7) Path.AddLine(Location.X + 3, Location.Y + 9, Location.X + 1, Location.Y + 9) Path.AddLine(Location.X + 0, Location.Y + 8, Location.X + 3, Location.Y + 5) Path.AddLine(Location.X + 3, Location.Y + 4, Location.X + 0, Location.Y + 1) Graphics.FillPath(Brushes.White, Path) Graphics.DrawPath(Pens.Black, Path) End Using End Sub Friend Shared Function CreateGradient(ByVal Width As Integer, ByVal Height As Integer, ByVal Color1 As Color, ByVal Color2 As Color) As LinearGradientBrush Return New LinearGradientBrush(New Point((Width / 2), 0), New Point((Width / 2), Height), Color1, Color2) End Function Friend Shared Sub DrawString(ByVal Graphics As Graphics, ByVal Font As Font, ByVal Text As String, ByVal Color As Color, ByVal HorizontalAlignment As StringAlignment, ByVal Location As PointF) Dim TextFormat As New StringFormat() TextFormat.Alignment = HorizontalAlignment Graphics.DrawString(Text, Font, New SolidBrush(Color), Location, TextFormat) End Sub End Class Class STTheme Inherits ContainerControl #Region "Properties" _ Public Overrides Property Text() As String Get If TypeOf Parent Is Form Then Return ParentForm.Text Else Return MyBase.Text End If End Get Set(ByVal value As String) If TypeOf Parent Is Form Then ParentForm.Text = value End If MyBase.Text = value Invalidate() End Set End Property _ Public Overrides Property ForeColor() As Color Get Return MyBase.ForeColor End Get Set(ByVal value As Color) MyBase.ForeColor = value If TypeOf Parent Is Form Then ParentForm.ForeColor = value End If Invalidate() End Set End Property Protected Overrides Property DoubleBuffered() As Boolean Get Return MyBase.DoubleBuffered End Get Set(ByVal value As Boolean) MyBase.DoubleBuffered = value Invalidate() End Set End Property Private MouseDownPoint As Point = Point.Empty Public Overridable Property Title() As String Get Return Text End Get Set(ByVal value As String) Text = value End Set End Property Public Overridable Property TitleColorFront() As Color Get Return ForeColor End Get Set(ByVal value As Color) ForeColor = value End Set End Property Private _TitleColorBack As Color Public Overridable Property TitleColorBack() As Color Get Return _TitleColorBack End Get Set(ByVal value As Color) _TitleColorBack = value Invalidate() End Set End Property Public Shadows Property Size() As Size Get Return MyBase.Size End Get Set(ByVal value As Size) If TypeOf Parent Is Form Then ParentForm.Size = value End If MyBase.Size = value Invalidate() End Set End Property Private _Radius As Integer = 5 Public Overridable Property Radius() As Integer Get Return _Radius End Get Set(ByVal value As Integer) _Radius = value Invalidate() End Set End Property Public Overridable Shadows Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal value As Color) MyBase.BackColor = value Invalidate() End Set End Property Private _BorderStyle As FormBorderStyle = FormBorderStyle.None Public Overridable Property BorderStyle() As FormBorderStyle Get If TypeOf Parent Is Form Then Return ParentForm.FormBorderStyle Else Return _BorderStyle End If End Get Set(ByVal value As FormBorderStyle) If TypeOf Parent Is Form Then ParentForm.FormBorderStyle = value End If _BorderStyle = value Invalidate() End Set End Property Private _TransparencyKey As Color = Color.Magenta Public Overridable Property TransparencyKey() As Color Get If TypeOf Parent Is Form Then Return ParentForm.TransparencyKey Else Return _TransparencyKey End If End Get Set(ByVal value As Color) If TypeOf Parent Is Form Then ParentForm.TransparencyKey = value End If _TransparencyKey = value Invalidate() End Set End Property Private _TopMost As Boolean = False Public Overridable Property TopMost() As Boolean Get If TypeOf Parent Is Form Then Return ParentForm.TopMost Else Return _TopMost End If End Get Set(ByVal value As Boolean) If TypeOf Parent Is Form Then ParentForm.TopMost = value End If _TopMost = value Invalidate() End Set End Property Private _StartPosition As FormStartPosition = FormStartPosition.CenterScreen Public Property StartPosition() As FormStartPosition Get If TypeOf Parent Is Form Then Return ParentForm.StartPosition Else Return _StartPosition End If End Get Set(ByVal value As FormStartPosition) If TypeOf Parent Is Form Then ParentForm.StartPosition = value End If _StartPosition = value End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Shadows Property TabIndex() As Integer Get Return MyBase.TabIndex End Get Set(ByVal value As Integer) MyBase.TabIndex = value End Set End Property _ Public Shadows Property TabStop() As Boolean Get Return MyBase.TabStop End Get Set(ByVal value As Boolean) MyBase.TabStop = value End Set End Property _ Public Overrides Property Anchor() As AnchorStyles Get Return MyBase.Anchor End Get Set(ByVal value As AnchorStyles) MyBase.Anchor = value End Set End Property _ Public Overrides Property AutoScroll() As Boolean Get Return MyBase.AutoScroll End Get Set(ByVal value As Boolean) MyBase.AutoScroll = value End Set End Property _ Public Shadows Property AutoScrollMargin() As Size Get Return MyBase.AutoScrollMargin End Get Set(ByVal value As Size) MyBase.AutoScrollMargin = value End Set End Property _ Public Shadows Property AutoScrollMinSize() As Size Get Return MyBase.AutoScrollMinSize End Get Set(ByVal value As Size) MyBase.AutoScrollMinSize = value End Set End Property _ Public Shadows Property Location() As Point Get Return MyBase.Location End Get Set(ByVal value As Point) MyBase.Location = value End Set End Property _ Public Overrides Property MinimumSize() As Size Get Return MyBase.MinimumSize End Get Set(ByVal value As Size) MyBase.MinimumSize = value End Set End Property _ Public Overrides Property MaximumSize() As Size Get Return MyBase.MaximumSize End Get Set(ByVal value As Size) MyBase.MaximumSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Overrides Property Dock() As DockStyle Get Return MyBase.Dock End Get Set(ByVal value As DockStyle) MyBase.Dock = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property _ Public Shadows Property Enabled() As Boolean Get Return MyBase.Enabled End Get Set(ByVal value As Boolean) MyBase.Enabled = value End Set End Property #End Region Public Sub New() BackColor = Color.FromArgb(50, 50, 50) Font = New Font("Verdana", 9, FontStyle.Bold) TitleColorFront = Color.White TitleColorBack = Color.Black DoubleBuffered = True End Sub Protected Overrides Sub OnParentChanged(ByVal e As System.EventArgs) If Not (TypeOf Parent Is Form) Then Return End If BorderStyle = FormBorderStyle.None ParentForm.BackColor = Color.Magenta TransparencyKey = ParentForm.BackColor Title = ParentForm.Text MyBase.OnParentChanged(e) End Sub Private Sub Load(ByVal sender As Object, ByVal e As System.EventArgs) End Sub Protected Overrides Sub OnResize(ByVal e As System.EventArgs) If TypeOf Parent Is Form Then Location = New Point(0, 0) ParentForm.Size = Size End If MyBase.OnResize(e) End Sub Protected Overrides Sub OnMove(ByVal e As System.EventArgs) If TypeOf Parent Is Form Then Location = New Point(0, 0) ParentForm.Size = Size End If MyBase.OnMove(e) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(TransparencyKey) NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(Color.Black, 1), BackColor) NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, 27), (Radius / 2), New Pen(Color.Black, 1), BackColor) NetTwist.DrawString(e.Graphics, Font, Title, TitleColorBack, StringAlignment.Near, New PointF(6, 6)) NetTwist.DrawString(e.Graphics, Font, Title, TitleColorFront, StringAlignment.Near, New PointF(5, 5)) End Sub Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs) If e.Button <> MouseButtons.Left Then Return End If MouseDownPoint = New Point(e.X, e.Y) End Sub Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs) If (Not (TypeOf Parent Is Form)) OrElse (MouseDownPoint = Point.Empty) Then Return End If ParentForm.Location = New Point((ParentForm.Left + e.X - MouseDownPoint.X), (ParentForm.Top + e.Y - MouseDownPoint.Y)) End Sub Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs) If e.Button <> MouseButtons.Left Then Return End If MouseDownPoint = Point.Empty End Sub End Class _ Class STTextBox Inherits Control #Region "Properties" Private Base As TextBox Public Overrides Property Text() As String Get Return MyBase.Text End Get Set(ByVal value As String) MyBase.Text = value Base.Text = value Invalidate() End Set End Property Public Overrides Property Font() As Font Get Return MyBase.Font End Get Set(ByVal value As Font) MyBase.Font = value Base.Font = value Invalidate() End Set End Property Private _BackColorTop As Color, _BackColorBottom As Color Public Overridable Property BackColorTop() As Color Get Return _BackColorTop End Get Set(ByVal value As Color) _BackColorTop = value Invalidate() End Set End Property Public Overridable Property BackColorBottom() As Color Get Return _BackColorBottom End Get Set(ByVal value As Color) _BackColorBottom = value Invalidate() End Set End Property Private _HorizontalAlignment As HorizontalAlignment = HorizontalAlignment.Left Public Overridable Property HorizontalAlignment() As HorizontalAlignment Get Return _HorizontalAlignment End Get Set(ByVal value As HorizontalAlignment) _HorizontalAlignment = value Base.TextAlign = value Invalidate() End Set End Property Public Overrides Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal value As Color) MyBase.BackColor = value Base.BackColor = value Invalidate() End Set End Property Public Overrides Property ForeColor() As Color Get Return MyBase.ForeColor End Get Set(ByVal value As Color) MyBase.ForeColor = value Base.ForeColor = value Invalidate() End Set End Property Private _OutlineColor As Color = Color.White Public Overridable Property OutlineColor() As Color Get Return _OutlineColor End Get Set(ByVal value As Color) _OutlineColor = value Invalidate() End Set End Property Private _PasswordChar As Char Public Overridable Property PasswordChar() As Char Get Return _PasswordChar End Get Set(ByVal value As Char) _PasswordChar = value Base.PasswordChar = value Invalidate() End Set End Property Private _Radius As Integer = 3 Public Overridable Property Radius() As Integer Get Return _Radius End Get Set(ByVal value As Integer) _Radius = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Overrides Property MinimumSize() As Size Get Return MyBase.MinimumSize End Get Set(ByVal value As Size) MyBase.MinimumSize = value End Set End Property _ Public Overrides Property MaximumSize() As Size Get Return MyBase.MaximumSize End Get Set(ByVal value As Size) MyBase.MaximumSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property #End Region Public Sub New() Cursor = Cursors.IBeam Base = New TextBox() AddHandler Base.TextChanged, AddressOf Base_TextChanged AddHandler Base.KeyDown, AddressOf Base_KeyDown Base.BorderStyle = BorderStyle.None Font = New Font("Verdana", 8, FontStyle.Regular) ForeColor = Color.White MinimumSize = New Size(40, 21) Size = New Size(120, MinimumSize.Height) OutlineColor = Color.FromArgb(30, 30, 30) BackColorTop = Color.FromArgb(60, 60, 60) BackColor = Color.FromArgb(50, 50, 50) BackColorBottom = Color.FromArgb(40, 40, 40) End Sub Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs) If Not Controls.Contains(Base) Then Controls.Add(Base) End If MyBase.OnHandleCreated(e) End Sub Private Sub Base_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) If (e.Control) AndAlso (e.KeyCode = Keys.A) Then Base.SelectAll() e.SuppressKeyPress = True End If End Sub Private Sub Base_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Text = Base.Text End Sub Protected Overrides Sub OnResize(ByVal e As System.EventArgs) Base.Location = New Point(4, 4) Base.Size = New Size((Width - 8), (Height - 8)) MyBase.OnResize(e) End Sub Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs) Base.Focus() MyBase.OnMouseDown(e) End Sub Protected Overrides Sub OnEnter(ByVal e As System.EventArgs) Base.Focus() Invalidate() MyBase.OnEnter(e) End Sub Protected Overrides Sub OnLeave(ByVal e As System.EventArgs) Invalidate() MyBase.OnLeave(e) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(Parent.BackColor) e.Graphics.SmoothingMode = SmoothingMode.AntiAlias NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(OutlineColor, 1), NetTwist.CreateGradient(Width, Height, BackColorTop, BackColorBottom)) End Sub End Class Class STComboBox Inherits ComboBox #Region "Properties" Private _BackColorTop As Color, _BackColorBottom As Color, _OutlineColor As Color, _TextColorBack As Color Public Overridable Property BackColorTop() As Color Get Return _BackColorTop End Get Set(ByVal value As Color) _BackColorTop = value Invalidate() End Set End Property Public Overridable Property BackColorBottom() As Color Get Return _BackColorBottom End Get Set(ByVal value As Color) _BackColorBottom = value Invalidate() End Set End Property Public Overridable Property OutlineColor() As Color Get Return _OutlineColor End Get Set(ByVal value As Color) _OutlineColor = value Invalidate() End Set End Property Public Overridable Property TextColor() As Color Get Return ForeColor End Get Set(ByVal value As Color) ForeColor = value Invalidate() End Set End Property Public Overridable Property TextColorBack() As Color Get Return _TextColorBack End Get Set(ByVal value As Color) _TextColorBack = value Invalidate() End Set End Property Private _Radius As Integer = 3 Public Overridable Property Radius() As Integer Get Return _Radius End Get Set(ByVal value As Integer) _Radius = value Invalidate() End Set End Property _ Public Overrides Property ForeColor() As Color Get Return MyBase.ForeColor End Get Set(ByVal value As Color) MyBase.ForeColor = value End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Overrides Property Anchor() As AnchorStyles Get Return MyBase.Anchor End Get Set(ByVal value As AnchorStyles) MyBase.Anchor = value End Set End Property _ Public Overrides Property MinimumSize() As Size Get Return MyBase.MinimumSize End Get Set(ByVal value As Size) MyBase.MinimumSize = value End Set End Property _ Public Overrides Property MaximumSize() As Size Get Return MyBase.MaximumSize End Get Set(ByVal value As Size) MyBase.MaximumSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property #End Region Public Sub New() SetStyle(DirectCast(139286, ControlStyles), True) SetStyle(ControlStyles.Selectable, False) BackColorTop = Color.FromArgb(60, 60, 60) BackColorBottom = Color.FromArgb(40, 40, 40) DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed DropDownStyle = ComboBoxStyle.DropDownList OutlineColor = Color.FromArgb(30, 30, 30) TextColor = Color.White TextColorBack = Color.Black Size = New Size(140, Height) Font = New Font("Verdana", 8, FontStyle.Regular) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) If (SelectedIndex = -1) AndAlso (Items.Count > 0) Then SelectedIndex = 0 Text = Items(0).ToString() Invalidate() End If e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit e.Graphics.Clear(Parent.BackColor) e.Graphics.SmoothingMode = SmoothingMode.AntiAlias NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(OutlineColor, 1), NetTwist.CreateGradient(Width, Height, BackColorTop, BackColorBottom)) Dim TextSize As SizeF = e.Graphics.MeasureString(Text, Font) NetTwist.DrawString(e.Graphics, Font, Text, TextColorBack, StringAlignment.Near, New PointF(5, ((Height / 2) - (TextSize.Height / 2) + 1))) NetTwist.DrawString(e.Graphics, Font, Text, TextColor, StringAlignment.Near, New PointF(4, ((Height / 2) - (TextSize.Height / 2)))) e.Graphics.DrawLine(New Pen(Brushes.Black, 2.0F), Width - 15, 10, Width - 11, 13) e.Graphics.DrawLine(New Pen(Brushes.Black, 2.0F), Width - 7, 10, Width - 11, 13) e.Graphics.DrawLine(Pens.Black, Width - 11, 13, Width - 11, 14) e.Graphics.DrawLine(New Pen(Color.White, 2.0F), Width - 16, 9, Width - 12, 12) e.Graphics.DrawLine(New Pen(Color.White, 2.0F), Width - 8, 9, Width - 12, 12) e.Graphics.DrawLine(Pens.White, Width - 12, 12, Width - 12, 13) e.Graphics.DrawLine(New Pen(Color.FromArgb(35, 35, 35)), Width - 22, 0, Width - 22, Height) e.Graphics.DrawLine(New Pen(Color.FromArgb(65, 65, 65)), (Width - 23), 2, (Width - 23), (Height - 4)) e.Graphics.DrawLine(New Pen(Color.FromArgb(65, 65, 65)), (Width - 21), 2, (Width - 21), (Height - 4)) End Sub Protected Overrides Sub OnDrawItem(ByVal e As DrawItemEventArgs) e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then e.Graphics.FillRectangle(New SolidBrush(BackColorTop), e.Bounds) Else e.Graphics.FillRectangle(New SolidBrush(BackColorBottom), e.Bounds) End If If Not (e.Index = -1) Then e.Graphics.DrawString(GetItemText(Items(e.Index)), e.Font, New SolidBrush(TextColor), e.Bounds) End If End Sub End Class Class STControlButton Inherits Control #Region "Properties" Public Enum Button Minimize Maximize Close End Enum Private _ControlButton As Button Public Property ControlButton() As Button Get Return _ControlButton End Get Set(ByVal value As Button) _ControlButton = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Shadows Property TabIndex() As Integer Get Return MyBase.TabIndex End Get Set(ByVal value As Integer) MyBase.TabIndex = value End Set End Property _ Public Shadows Property TabStop() As Boolean Get Return MyBase.TabStop End Get Set(ByVal value As Boolean) MyBase.TabStop = value End Set End Property _ Public Overrides Property MinimumSize() As Size Get Return MyBase.MinimumSize End Get Set(ByVal value As Size) MyBase.MinimumSize = value End Set End Property _ Public Overrides Property MaximumSize() As Size Get Return MyBase.MaximumSize End Get Set(ByVal value As Size) MyBase.MaximumSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Overrides Property Dock() As DockStyle Get Return MyBase.Dock End Get Set(ByVal value As DockStyle) MyBase.Dock = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property _ Public Shadows Property Enabled() As Boolean Get Return MyBase.Enabled End Get Set(ByVal value As Boolean) MyBase.Enabled = value End Set End Property #End Region Public Sub New() Anchor = AnchorStyles.Top Or AnchorStyles.Right ControlButton = Button.Close Size = New Size(18, 20) MinimumSize = Size MaximumSize = Size Margin = New Padding(0) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(Parent.BackColor) Select Case ControlButton Case Button.Close NetTwist.DrawCross(e.Graphics, New Point(4, 5)) Exit Select Case Button.Maximize If FindForm().WindowState = FormWindowState.Maximized Then DrawRestore(e.Graphics, New Point(3, 4)) Else DrawMaximize(e.Graphics, New Point(3, 5)) End If Exit Select Case Button.Minimize DrawMinimize(e.Graphics, New Point(3, 10)) Exit Select End Select End Sub Protected Overrides Sub OnMouseClick(ByVal e As MouseEventArgs) If e.Button = System.Windows.Forms.MouseButtons.Left Then Dim ParentForm As Form = FindForm() Select Case ControlButton Case Button.Minimize ParentForm.WindowState = FormWindowState.Minimized Exit Select Case Button.Maximize If ParentForm.WindowState = FormWindowState.Normal Then ParentForm.WindowState = FormWindowState.Maximized Else ParentForm.WindowState = FormWindowState.Normal End If Exit Select Case Button.Close ParentForm.Close() Exit Select End Select End If Invalidate() MyBase.OnMouseClick(e) End Sub Private Sub DrawMinimize(ByVal Graphics As Graphics, ByVal Location As Point) Graphics.FillRectangle(Brushes.White, Location.X, Location.Y, 12, 5) Graphics.DrawRectangle(Pens.Black, Location.X, Location.Y, 11, 4) End Sub Private Sub DrawMaximize(ByVal Graphics As Graphics, ByVal Location As Point) Graphics.DrawRectangle(New Pen(Color.White, 2), Location.X + 2, Location.Y + 2, 8, 6) Graphics.DrawRectangle(Pens.Black, Location.X, Location.Y, 11, 9) Graphics.DrawRectangle(Pens.Black, Location.X + 3, Location.Y + 3, 5, 3) End Sub Private Sub DrawRestore(ByVal Graphics As Graphics, ByVal Location As Point) Graphics.FillRectangle(Brushes.White, Location.X + 3, Location.Y + 1, 8, 4) Graphics.FillRectangle(Brushes.White, Location.X + 7, Location.Y + 5, 4, 4) Graphics.DrawRectangle(Pens.Black, Location.X + 2, Location.Y + 0, 9, 9) Graphics.FillRectangle(Brushes.White, Location.X + 1, Location.Y + 3, 2, 6) Graphics.FillRectangle(Brushes.White, Location.X + 1, Location.Y + 9, 8, 2) Graphics.DrawRectangle(Pens.Black, Location.X, Location.Y + 2, 9, 9) Graphics.DrawRectangle(Pens.Black, Location.X + 3, Location.Y + 5, 3, 3) End Sub End Class Class STLabel Inherits Control #Region "Properties" _ Public Overrides Property ForeColor() As Color Get Return MyBase.ForeColor End Get Set(ByVal value As Color) MyBase.ForeColor = value End Set End Property _ Public Overrides Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal value As Color) MyBase.BackColor = value End Set End Property Private _TextColorBack As Color Public Overridable Property TextColor() As Color Get Return ForeColor End Get Set(ByVal value As Color) ForeColor = value Invalidate() End Set End Property Public Overridable Property TextColorBack() As Color Get Return _TextColorBack End Get Set(ByVal value As Color) _TextColorBack = value Invalidate() End Set End Property Public Overrides Property Text() As String Get Return MyBase.Text End Get Set(ByVal value As String) MyBase.Text = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Shadows Property TabIndex() As Integer Get Return MyBase.TabIndex End Get Set(ByVal value As Integer) MyBase.TabIndex = value End Set End Property _ Public Shadows Property TabStop() As Boolean Get Return MyBase.TabStop End Get Set(ByVal value As Boolean) MyBase.TabStop = value End Set End Property _ Public Overrides Property MinimumSize() As Size Get Return MyBase.MinimumSize End Get Set(ByVal value As Size) MyBase.MinimumSize = value End Set End Property _ Public Overrides Property MaximumSize() As Size Get Return MyBase.MaximumSize End Get Set(ByVal value As Size) MyBase.MaximumSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Overrides Property Dock() As DockStyle Get Return MyBase.Dock End Get Set(ByVal value As DockStyle) MyBase.Dock = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property _ Public Shadows Property Enabled() As Boolean Get Return MyBase.Enabled End Get Set(ByVal value As Boolean) MyBase.Enabled = value End Set End Property #End Region Public Sub New() TextColor = Color.White TextColorBack = Color.Black Font = New Font("Verdana", 8, FontStyle.Regular) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) Dim TextSize As SizeF = e.Graphics.MeasureString(Text, Font) Size = New Size(CInt(TextSize.Width), CInt(TextSize.Height)) e.Graphics.Clear(Parent.BackColor) NetTwist.DrawString(e.Graphics, Font, Text, TextColorBack, StringAlignment.Near, New PointF(1, 1)) NetTwist.DrawString(e.Graphics, Font, Text, TextColor, StringAlignment.Near, New PointF(0, 0)) End Sub End Class _ Class STRadioButton Inherits Control #Region "Properties" _ Public Overrides Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal value As Color) MyBase.BackColor = value End Set End Property _ Public Overrides Property ForeColor() As Color Get Return MyBase.ForeColor End Get Set(ByVal value As Color) MyBase.ForeColor = value End Set End Property Public Event CheckedChanged As CheckedChangedEventHandler Public Delegate Sub CheckedChangedEventHandler(ByVal sender As Object) Private _BorderThickness As Integer = 2 Public Overridable Property BorderThickness() As Integer Get Return _BorderThickness End Get Set(ByVal value As Integer) _BorderThickness = value Invalidate() End Set End Property Private _Checked As Boolean Public Property Checked() As Boolean Get Return _Checked End Get Set(ByVal value As Boolean) _Checked = value If value Then InvalidateParent() End If RaiseEvent CheckedChanged(Me) Invalidate() End Set End Property Public Overrides Property Text() As String Get Return MyBase.Text End Get Set(ByVal value As String) MyBase.Text = value Invalidate() End Set End Property Public Overridable Property TextColor() As Color Get Return ForeColor End Get Set(ByVal value As Color) ForeColor = value Invalidate() End Set End Property Public Overridable Property TextColorBack() As Color Get Return _TextColorBack End Get Set(ByVal value As Color) _TextColorBack = value Invalidate() End Set End Property Private _BackColorTop As Color, _BackColorBottom As Color, _TextColorBack As Color, _OutlineColor As Color, _CheckedColor As Color Public Overridable Property CheckedColor() As Color Get Return _CheckedColor End Get Set(ByVal value As Color) _CheckedColor = value Invalidate() End Set End Property Public Overridable Property OutlineColor() As Color Get Return _OutlineColor End Get Set(ByVal value As Color) _OutlineColor = value Invalidate() End Set End Property Public Overridable Property BackColorTop() As Color Get Return _BackColorTop End Get Set(ByVal value As Color) _BackColorTop = value Invalidate() End Set End Property Public Overridable Property BackColorBottom() As Color Get Return _BackColorBottom End Get Set(ByVal value As Color) _BackColorBottom = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Overrides Property MinimumSize() As Size Get Return MyBase.MinimumSize End Get Set(ByVal value As Size) MyBase.MinimumSize = value End Set End Property _ Public Overrides Property MaximumSize() As Size Get Return MyBase.MaximumSize End Get Set(ByVal value As Size) MyBase.MaximumSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Overrides Property Dock() As DockStyle Get Return MyBase.Dock End Get Set(ByVal value As DockStyle) MyBase.Dock = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property #End Region Public Sub New() TextColor = Color.White TextColorBack = Color.Black OutlineColor = Color.FromArgb(40, 40, 40) CheckedColor = Color.White Font = New Font("Verdana", 8, FontStyle.Regular) MinimumSize = New Size(Width, 17) Size = MinimumSize End Sub Private Sub InvalidateParent() If Parent Is Nothing Then Return End If For Each Control As Control In Parent.Controls If (Not ReferenceEquals(Control, Me)) AndAlso (TypeOf Control Is STRadioButton) Then TryCast(Control, STRadioButton).Checked = False End If Next End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(Parent.BackColor) e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit e.Graphics.SmoothingMode = SmoothingMode.AntiAlias Dim Bounds As New Rectangle(3, 2, (Height - 5), (Height - 5)) Dim Path As New GraphicsPath() Path.AddEllipse(Bounds) Dim Brush As New PathGradientBrush(Path) Brush.CenterColor = BackColorTop Brush.SurroundColors = New Color() {BackColorBottom} Brush.FocusScales = New PointF(0.3F, 0.3F) e.Graphics.FillPath(Brush, Path) e.Graphics.DrawEllipse(New Pen(OutlineColor, BorderThickness), Bounds) If Checked Then Dim CheckedBounds As New Rectangle((Bounds.X + 4), (Bounds.Y + 4), (Bounds.Height - 8), (Bounds.Height - 8)) e.Graphics.FillEllipse(New SolidBrush(CheckedColor), CheckedBounds) e.Graphics.DrawEllipse(New Pen(CheckedColor, BorderThickness), CheckedBounds) End If Dim TextSize As SizeF = e.Graphics.MeasureString(Text, Font) Size = New Size((CInt(TextSize.Width) + Height), Height) Dim TextLocation As New Point(Height, ((Height / 2) - CInt(TextSize.Height / 2))) NetTwist.DrawString(e.Graphics, Font, Text, TextColorBack, StringAlignment.Near, New PointF((TextLocation.X + 1), (TextLocation.Y + 1))) NetTwist.DrawString(e.Graphics, Font, Text, TextColor, StringAlignment.Near, New PointF(TextLocation.X, TextLocation.Y)) End Sub Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs) Checked = True MyBase.OnMouseDown(e) End Sub End Class _ Class STCheckBox Inherits Control #Region "Properties" _ Public Overrides Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal value As Color) MyBase.BackColor = value End Set End Property _ Public Overrides Property ForeColor() As Color Get Return MyBase.ForeColor End Get Set(ByVal value As Color) MyBase.ForeColor = value End Set End Property Public Event CheckedChanged As CheckedChangedEventHandler Public Delegate Sub CheckedChangedEventHandler(ByVal sender As Object) Public Enum CheckedTypes Blop Cross Tick End Enum Private _CheckedType As CheckedTypes = CheckedTypes.Blop Private _BorderThickness As Integer = 2 Public Overridable Property BorderThickness() As Integer Get Return _BorderThickness End Get Set(ByVal value As Integer) _BorderThickness = value Invalidate() End Set End Property Public Overridable Property CheckedType() As CheckedTypes Get Return _CheckedType End Get Set(ByVal value As CheckedTypes) _CheckedType = value Invalidate() End Set End Property Private _Checked As Boolean Public Property Checked() As Boolean Get Return _Checked End Get Set(ByVal value As Boolean) _Checked = value RaiseEvent CheckedChanged(Me) Invalidate() End Set End Property Public Overrides Property Text() As String Get Return MyBase.Text End Get Set(ByVal value As String) MyBase.Text = value Invalidate() End Set End Property Public Overridable Property TextColor() As Color Get Return ForeColor End Get Set(ByVal value As Color) ForeColor = value Invalidate() End Set End Property Public Overridable Property TextColorBack() As Color Get Return _TextColorBack End Get Set(ByVal value As Color) _TextColorBack = value Invalidate() End Set End Property Private _BackColorTop As Color, _BackColorBottom As Color, _TextColorBack As Color, _OutlineColor As Color, _CheckedColor As Color, _CheckedColorBack As Color Public Overridable Property CheckedColor() As Color Get Return _CheckedColor End Get Set(ByVal value As Color) _CheckedColor = value Invalidate() End Set End Property Public Overridable Property CheckedColorBack() As Color Get Return _CheckedColorBack End Get Set(ByVal value As Color) _CheckedColorBack = value Invalidate() End Set End Property Public Overridable Property OutlineColor() As Color Get Return _OutlineColor End Get Set(ByVal value As Color) _OutlineColor = value Invalidate() End Set End Property Public Overridable Property BackColorTop() As Color Get Return _BackColorTop End Get Set(ByVal value As Color) _BackColorTop = value Invalidate() End Set End Property Public Overridable Property BackColorBottom() As Color Get Return _BackColorBottom End Get Set(ByVal value As Color) _BackColorBottom = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Overrides Property MinimumSize() As Size Get Return MyBase.MinimumSize End Get Set(ByVal value As Size) MyBase.MinimumSize = value End Set End Property _ Public Overrides Property MaximumSize() As Size Get Return MyBase.MaximumSize End Get Set(ByVal value As Size) MyBase.MaximumSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Overrides Property Dock() As DockStyle Get Return MyBase.Dock End Get Set(ByVal value As DockStyle) MyBase.Dock = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property #End Region Public Sub New() TextColor = Color.White TextColorBack = Color.Black OutlineColor = Color.FromArgb(40, 40, 40) CheckedColor = Color.White CheckedColorBack = Color.Black Font = New Font("Verdana", 8, FontStyle.Regular) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(Parent.BackColor) e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit e.Graphics.SmoothingMode = SmoothingMode.AntiAlias Dim Bounds As New Rectangle(3, 2, (Height - 5), (Height - 5)) NetTwist.DrawRoundRectangle(e.Graphics, Bounds, 1, New Pen(OutlineColor, BorderThickness), NetTwist.CreateGradient(Width, Height, BackColorTop, BackColorBottom)) If Checked Then Dim CheckedBounds As New Rectangle((Bounds.X + 2), (Bounds.Y + 2), (Bounds.Height - 4), (Bounds.Height - 4)) Select Case CheckedType Case CheckedTypes.Blop NetTwist.DrawRoundRectangle(e.Graphics, CheckedBounds, 1, New Pen(OutlineColor, BorderThickness), CheckedColor) Exit Select Case CheckedTypes.Cross Using Path As New GraphicsPath() Path.AddLine(CheckedBounds.X, CheckedBounds.Y - 1, CheckedBounds.X + 2, CheckedBounds.Y - 1) Path.AddLine(CheckedBounds.X + 4, CheckedBounds.Y + 1, CheckedBounds.X + 6, CheckedBounds.Y - 1) Path.AddLine(CheckedBounds.X + 8, CheckedBounds.Y - 1, CheckedBounds.X + 9, CheckedBounds.Y) Path.AddLine(CheckedBounds.X + 6, CheckedBounds.Y + 3, CheckedBounds.X + 6, CheckedBounds.Y + 4) Path.AddLine(CheckedBounds.X + 9, CheckedBounds.Y + 7, CheckedBounds.X + 8, CheckedBounds.Y + 8) Path.AddLine(CheckedBounds.X + 6, CheckedBounds.Y + 8, CheckedBounds.X + 4, CheckedBounds.Y + 6) Path.AddLine(CheckedBounds.X + 2, CheckedBounds.Y + 8, CheckedBounds.X, CheckedBounds.Y + 8) Path.AddLine(CheckedBounds.X - 1, CheckedBounds.Y + 7, CheckedBounds.X + 2, CheckedBounds.Y + 4) Path.AddLine(CheckedBounds.X + 2, CheckedBounds.Y + 3, CheckedBounds.X - 1, CheckedBounds.Y) e.Graphics.FillPath(Brushes.White, Path) e.Graphics.DrawPath(Pens.Black, Path) End Using Exit Select Case CheckedTypes.Tick e.Graphics.DrawLine(New Pen(CheckedColorBack, BorderThickness), 6, (Height - 6), 9, (Height - 7)) e.Graphics.DrawLine(New Pen(CheckedColorBack, BorderThickness), 8, (Height - 4), (Height - 3), 6) e.Graphics.DrawLine(New Pen(CheckedColor, BorderThickness), 5, (Height - 8), 8, (Height - 6)) e.Graphics.DrawLine(New Pen(CheckedColor, BorderThickness), 7, (Height - 6), (Height - 5), 4) Exit Select End Select End If Dim TextSize As SizeF = e.Graphics.MeasureString(Text, Font) Size = New Size((CInt(TextSize.Width) + Height), Height) Dim TextLocation As New Point(Height, ((Height / 2) - CInt(TextSize.Height / 2))) NetTwist.DrawString(e.Graphics, Font, Text, TextColorBack, StringAlignment.Near, New PointF((TextLocation.X + 1), (TextLocation.Y + 1))) NetTwist.DrawString(e.Graphics, Font, Text, TextColor, StringAlignment.Near, New PointF(TextLocation.X, TextLocation.Y)) End Sub Protected Overrides Sub OnMouseClick(ByVal e As MouseEventArgs) Checked = Not Checked MyBase.OnMouseClick(e) End Sub End Class Class STProgressBar Inherits Control #Region "Properties" Private _Minimum As Integer = 0, _Value As Integer = 50, _Maximum As Integer = 100 Public Overridable Property Minimum() As Integer Get Return _Minimum End Get Set(ByVal value As Integer) If (value >= 0) AndAlso (value < Maximum) Then _Minimum = value Invalidate() End If End Set End Property Public Overridable Property Value() As Integer Get Return _Value End Get Set(ByVal value As Integer) If value < Minimum Then value = Minimum ElseIf value > Maximum Then value = Maximum End If _Value = value Invalidate() End Set End Property Public Overridable Property Maximum() As Integer Get Return _Maximum End Get Set(ByVal value As Integer) If value <= Minimum Then value = (Minimum + 1) End If _Maximum = value Invalidate() End Set End Property Public Enum ProgressTexts None Flow Bubble AlignLeft AlignCenter AlignRight End Enum Private _ProgressText As ProgressTexts = ProgressTexts.None Public Property ProgressText() As ProgressTexts Get Return _ProgressText End Get Set(ByVal value As ProgressTexts) _ProgressText = value Invalidate() End Set End Property Private _BackColorTop As Color, _BackColorBottom As Color, _OutlineColor As Color, _TextColorBack As Color, _ProgressColor As Color, _ProgressColorBack As Color, _ _ProgressOutlineColor As Color, _ProgressTextColor As Color, _ProgressTextBackColor As Color Public Overridable Property ProgressTextColor() As Color Get Return _ProgressTextColor End Get Set(ByVal value As Color) _ProgressTextColor = value Invalidate() End Set End Property Public Overridable Property ProgressTextBackColor() As Color Get Return _ProgressTextBackColor End Get Set(ByVal value As Color) _ProgressTextBackColor = value Invalidate() End Set End Property Public Overridable Property ProgressOutlineColor() As Color Get Return _ProgressOutlineColor End Get Set(ByVal value As Color) _ProgressOutlineColor = value Invalidate() End Set End Property Public Overridable Property ProgressColor() As Color Get Return _ProgressColor End Get Set(ByVal value As Color) _ProgressColor = value Invalidate() End Set End Property Public Overridable Property ProgressColorBack() As Color Get Return _ProgressColorBack End Get Set(ByVal value As Color) _ProgressColorBack = value Invalidate() End Set End Property Public Overridable Property BackColorTop() As Color Get Return _BackColorTop End Get Set(ByVal value As Color) _BackColorTop = value Invalidate() End Set End Property Public Overridable Property BackColorBottom() As Color Get Return _BackColorBottom End Get Set(ByVal value As Color) _BackColorBottom = value Invalidate() End Set End Property Public Overridable Property OutlineColor() As Color Get Return _OutlineColor End Get Set(ByVal value As Color) _OutlineColor = value Invalidate() End Set End Property Public Overridable Property TextColor() As Color Get Return ForeColor End Get Set(ByVal value As Color) ForeColor = value Invalidate() End Set End Property Public Overridable Property TextColorBack() As Color Get Return _TextColorBack End Get Set(ByVal value As Color) _TextColorBack = value Invalidate() End Set End Property Private _BorderThickness As Integer = 1 Public Overridable Property BorderThickness() As Integer Get Return _BorderThickness End Get Set(ByVal value As Integer) _BorderThickness = value Invalidate() End Set End Property Private _Radius As Integer = 3 Public Overridable Property Radius() As Integer Get Return _Radius End Get Set(ByVal value As Integer) _Radius = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Shadows Property TabIndex() As Integer Get Return MyBase.TabIndex End Get Set(ByVal value As Integer) MyBase.TabIndex = value End Set End Property _ Public Shadows Property TabStop() As Boolean Get Return MyBase.TabStop End Get Set(ByVal value As Boolean) MyBase.TabStop = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property _ Public Shadows Property Enabled() As Boolean Get Return MyBase.Enabled End Get Set(ByVal value As Boolean) MyBase.Enabled = value End Set End Property #End Region Public Sub New() MinimumSize = New Size(100, 10) Size = New Size(200, 15) Font = New Font("Verdana", 6, FontStyle.Bold) BackColorBottom = Color.FromArgb(40, 40, 40) BackColorTop = Color.FromArgb(60, 60, 60) OutlineColor = Color.FromArgb(20, 20, 20) ProgressColor = Color.SkyBlue ProgressColorBack = Color.DeepSkyBlue ProgressOutlineColor = Color.DeepSkyBlue ProgressTextColor = Color.White ProgressTextBackColor = Color.Black End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(Parent.BackColor) NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(OutlineColor, BorderThickness), NetTwist.CreateGradient(Width, Height, BackColorTop, BackColorBottom)) Dim ProgressWidth As Integer = CInt((CSng(Value) / CSng(Maximum)) * CSng(Width)) NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(3, 3, (ProgressWidth - 6), (Height - 6)), Radius, New Pen(ProgressOutlineColor, BorderThickness), NetTwist.CreateGradient(Width, Height, ProgressColor, ProgressColorBack)) Dim ProgressTextS__1 As String = (CInt((CSng(Value) / CSng(Maximum)) * 100.0F).ToString() + "%") Dim ProgressTextWidth As Integer = CInt(e.Graphics.MeasureString(ProgressTextS__1, Font).Width) Select Case ProgressText Case ProgressTexts.Flow Dim ProgressTextX As Integer = (Math.Min((Width - ProgressTextWidth), ProgressWidth)) NetTwist.DrawString(e.Graphics, Font, ProgressTextS__1, ProgressTextBackColor, StringAlignment.Near, New PointF((ProgressTextX + 1), (((Height / 2) - (e.Graphics.MeasureString(ProgressTextS__1, Font).Height / 2)) + 1))) NetTwist.DrawString(e.Graphics, Font, ProgressTextS__1, ProgressTextColor, StringAlignment.Near, New PointF(ProgressTextX, ((Height / 2) - (e.Graphics.MeasureString(ProgressTextS__1, Font).Height / 2)))) Exit Select End Select End Sub End Class Class STGroupBox Inherits ContainerControl #Region "Properties" _ Public Overrides Property Text() As String Get Return MyBase.Text End Get Set(ByVal value As String) MyBase.Text = value End Set End Property _ Public Overrides Property Font() As Font Get Return MyBase.Font End Get Set(ByVal value As Font) MyBase.Font = value End Set End Property Private _Title As String, _Description As String Public Overridable Property Title() As String Get Return _Title End Get Set(ByVal value As String) _Title = value Invalidate() End Set End Property Public Overridable Property Description() As String Get Return _Description End Get Set(ByVal value As String) _Description = value Invalidate() End Set End Property Private _TitleColor As Color, _TitleBackColor As Color, _DescriptionColor As Color, _DescriptionBackColor As Color, _OutlineColor As Color, _SeperatorColor As Color Public Overridable Property TitleColor() As Color Get Return _TitleColor End Get Set(ByVal value As Color) _TitleColor = value Invalidate() End Set End Property Public Overridable Property TitleBackColor() As Color Get Return _TitleBackColor End Get Set(ByVal value As Color) _TitleBackColor = value Invalidate() End Set End Property Public Overridable Property DescriptionColor() As Color Get Return _DescriptionColor End Get Set(ByVal value As Color) _DescriptionColor = value Invalidate() End Set End Property Public Overridable Property DescriptionBackColor() As Color Get Return _DescriptionBackColor End Get Set(ByVal value As Color) _DescriptionBackColor = value Invalidate() End Set End Property Public Overridable Property OutlineColor() As Color Get Return _OutlineColor End Get Set(ByVal value As Color) _OutlineColor = value Invalidate() End Set End Property Public Overridable Property SeperatorColor() As Color Get Return _SeperatorColor End Get Set(ByVal value As Color) _SeperatorColor = value Invalidate() End Set End Property Private _TitleFont As Font, _DescriptionFont As Font Public Overridable Property TitleFont() As Font Get Return _TitleFont End Get Set(ByVal value As Font) _TitleFont = value Invalidate() End Set End Property Public Overridable Property DescriptionFont() As Font Get Return _DescriptionFont End Get Set(ByVal value As Font) _DescriptionFont = value Invalidate() End Set End Property Private _Radius As Integer = 3, _OutlineThickness As Integer = 1, _SeperatorThickness As Integer = 2 Public Overridable Property Radius() As Integer Get Return _Radius End Get Set(ByVal value As Integer) _Radius = value Invalidate() End Set End Property Public Overridable Property OutlineThickness() As Integer Get Return _OutlineThickness End Get Set(ByVal value As Integer) _OutlineThickness = value Invalidate() End Set End Property Public Overridable Property SeperatorThickness() As Integer Get Return _SeperatorThickness End Get Set(ByVal value As Integer) _SeperatorThickness = value Invalidate() End Set End Property Public Enum DescriptionAligns NextTo Underneath End Enum Private _DescriptionAlign As DescriptionAligns = DescriptionAligns.Underneath Public Overridable Property DescriptionAlign() As DescriptionAligns Get Return _DescriptionAlign End Get Set(ByVal value As DescriptionAligns) _DescriptionAlign = value Invalidate() End Set End Property Private _DrawSeperator As Boolean = True Public Overridable Property DrawSeperator() As Boolean Get Return _DrawSeperator End Get Set(ByVal value As Boolean) _DrawSeperator = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Shadows Property TabIndex() As Integer Get Return MyBase.TabIndex End Get Set(ByVal value As Integer) MyBase.TabIndex = value End Set End Property _ Public Shadows Property TabStop() As Boolean Get Return MyBase.TabStop End Get Set(ByVal value As Boolean) MyBase.TabStop = value End Set End Property _ Public Overrides Property AutoScroll() As Boolean Get Return MyBase.AutoScroll End Get Set(ByVal value As Boolean) MyBase.AutoScroll = value End Set End Property _ Public Shadows Property AutoScrollMargin() As Size Get Return MyBase.AutoScrollMargin End Get Set(ByVal value As Size) MyBase.AutoScrollMargin = value End Set End Property _ Public Shadows Property AutoScrollMinSize() As Size Get Return MyBase.AutoScrollMinSize End Get Set(ByVal value As Size) MyBase.AutoScrollMinSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property #End Region Public Sub New() Title = "Group Title" Description = "Group Description" TitleFont = New Font("Verdana", 9, FontStyle.Bold) DescriptionFont = New Font("Verdana", 6, FontStyle.Italic) TitleColor = Color.DeepSkyBlue DescriptionColor = Color.White TitleBackColor = Color.Black DescriptionBackColor = Color.Black OutlineColor = Color.FromArgb(30, 30, 30) SeperatorColor = Color.FromArgb(43, 43, 43) Size = New Size(300, 300) End Sub Protected Overrides Sub OnParentChanged(ByVal e As EventArgs) BackColor = Parent.BackColor MyBase.OnParentChanged(e) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(Parent.BackColor) NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(OutlineColor, OutlineThickness), BackColor) Dim TitleSize As SizeF = e.Graphics.MeasureString(Title, TitleFont) NetTwist.DrawString(e.Graphics, TitleFont, Title, TitleBackColor, StringAlignment.Near, New PointF(3, 3)) NetTwist.DrawString(e.Graphics, TitleFont, Title, TitleColor, StringAlignment.Near, New PointF(2, 2)) Dim DescriptionSize As SizeF = e.Graphics.MeasureString(Description, DescriptionFont) Select Case DescriptionAlign Case DescriptionAligns.NextTo NetTwist.DrawString(e.Graphics, DescriptionFont, Description, DescriptionBackColor, StringAlignment.Near, New PointF((3 + TitleSize.Width), (3 + ((TitleSize.Height / 2) - (DescriptionSize.Height / 2))))) NetTwist.DrawString(e.Graphics, DescriptionFont, Description, DescriptionColor, StringAlignment.Near, New PointF((2 + TitleSize.Width), (2 + ((TitleSize.Height / 2) - (DescriptionSize.Height / 2))))) Exit Select Case DescriptionAligns.Underneath NetTwist.DrawString(e.Graphics, DescriptionFont, Description, DescriptionBackColor, StringAlignment.Near, New PointF(5, (3 + TitleSize.Height))) NetTwist.DrawString(e.Graphics, DescriptionFont, Description, DescriptionColor, StringAlignment.Near, New PointF(4, (2 + TitleSize.Height))) Exit Select End Select If DrawSeperator Then Dim SeperatorY As Integer = (If((DescriptionAlign = DescriptionAligns.NextTo), (3 + CInt(TitleSize.Height)), (6 + CInt(TitleSize.Height) + CInt(DescriptionSize.Height)))) e.Graphics.DrawLine(New Pen(SeperatorColor, SeperatorThickness), New Point(3, SeperatorY), New Point((Width - 3), SeperatorY)) End If End Sub End Class Class STButton Inherits Control #Region "Properties" _ Public Overrides Property ForeColor() As Color Get Return MyBase.ForeColor End Get Set(ByVal value As Color) MyBase.ForeColor = value End Set End Property Public Overridable Shadows Property Enabled() As Boolean Get Return MyBase.Enabled End Get Set(ByVal value As Boolean) MyBase.Enabled = value Invalidate() End Set End Property Public Overrides Property Text() As String Get Return MyBase.Text End Get Set(ByVal value As String) MyBase.Text = value Invalidate() End Set End Property Private Pressed As Boolean = False, Hovering As Boolean = False Private _VerticalTextAlign As StringAlignment = StringAlignment.Center, _HorizontalTextAlign As StringAlignment = StringAlignment.Center Public Property VerticalTextAlign() As StringAlignment Get Return _VerticalTextAlign End Get Set(ByVal value As StringAlignment) _VerticalTextAlign = value Invalidate() End Set End Property Public Property HorizontalTextAlign() As StringAlignment Get Return _HorizontalTextAlign End Get Set(ByVal value As StringAlignment) _HorizontalTextAlign = value Invalidate() End Set End Property Private _BackColorTop As Color, _BackColorBottom As Color, _OutlineColor As Color, _HoverTopColor As Color, _HoverBottomColor As Color, _PressedTopColor As Color, _ _PressedBottomColor As Color, _TextColor As Color, _TextBackColor As Color, _DisabledTopColor As Color, _DisabledBottomColor As Color Public Overridable Property DisabledTopColor() As Color Get Return _DisabledTopColor End Get Set(ByVal value As Color) _DisabledTopColor = value Invalidate() End Set End Property Public Overridable Property DisabledBottomColor() As Color Get Return _DisabledBottomColor End Get Set(ByVal value As Color) _DisabledBottomColor = value Invalidate() End Set End Property Public Overridable Property TextColor() As Color Get Return _TextColor End Get Set(ByVal value As Color) _TextColor = value Invalidate() End Set End Property Public Overridable Property TextBackColor() As Color Get Return _TextBackColor End Get Set(ByVal value As Color) _TextBackColor = value Invalidate() End Set End Property Public Overridable Property PressedTopColor() As Color Get Return _PressedTopColor End Get Set(ByVal value As Color) _PressedTopColor = value Invalidate() End Set End Property Public Overridable Property PressedBottomColor() As Color Get Return _PressedBottomColor End Get Set(ByVal value As Color) _PressedBottomColor = value Invalidate() End Set End Property Public Overridable Property HoverColor() As Color Get Return _HoverTopColor End Get Set(ByVal value As Color) _HoverTopColor = value Invalidate() End Set End Property Public Overridable Property HoverBackColor() As Color Get Return _HoverBottomColor End Get Set(ByVal value As Color) _HoverBottomColor = value Invalidate() End Set End Property Public Overridable Property OutlineColor() As Color Get Return _OutlineColor End Get Set(ByVal value As Color) _OutlineColor = value Invalidate() End Set End Property Public Overridable Property BackColorTop() As Color Get Return _BackColorTop End Get Set(ByVal value As Color) _BackColorTop = value Invalidate() End Set End Property Public Overridable Property BackColorBottom() As Color Get Return _BackColorBottom End Get Set(ByVal value As Color) _BackColorBottom = value Invalidate() End Set End Property Private _Radius As Integer = 3, _OutlineThickness As Integer = 1 Public Overridable Property Radius() As Integer Get Return _Radius End Get Set(ByVal value As Integer) _Radius = value Invalidate() End Set End Property Public Overridable Property OutlineThickness() As Integer Get Return _OutlineThickness End Get Set(ByVal value As Integer) _OutlineThickness = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property #End Region Public Sub New() BackColorTop = Color.FromArgb(60, 60, 60) BackColorBottom = Color.FromArgb(40, 40, 40) HoverColor = Color.FromArgb(80, 80, 80) HoverBackColor = Color.FromArgb(60, 60, 60) PressedTopColor = Color.FromArgb(70, 70, 70) PressedBottomColor = Color.FromArgb(50, 50, 50) OutlineColor = Color.FromArgb(30, 30, 30) TextColor = Color.White TextBackColor = Color.Black DisabledTopColor = Color.FromArgb(30, 30, 30) DisabledBottomColor = Color.FromArgb(40, 40, 40) MinimumSize = New Size(15, 15) Size = New Size(140, 20) Font = New Font("Verdana", 8, FontStyle.Regular) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(Parent.BackColor) If Not Enabled Then NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(OutlineColor, OutlineThickness), NetTwist.CreateGradient(Width, Height, DisabledTopColor, DisabledBottomColor)) Else If Pressed Then NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(OutlineColor, OutlineThickness), NetTwist.CreateGradient(Width, Height, PressedTopColor, PressedBottomColor)) ElseIf Hovering Then NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(OutlineColor, OutlineThickness), NetTwist.CreateGradient(Width, Height, HoverColor, HoverBackColor)) Else NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, Width, Height), Radius, New Pen(OutlineColor, OutlineThickness), NetTwist.CreateGradient(Width, Height, BackColorTop, BackColorBottom)) End If End If Dim SF As New StringFormat() SF.Alignment = HorizontalTextAlign SF.LineAlignment = VerticalTextAlign e.Graphics.DrawString(Text, Font, New SolidBrush(TextBackColor), New PointF(((Width / 2) + 1), ((Height / 2) + 1)), SF) e.Graphics.DrawString(Text, Font, New SolidBrush(TextColor), New PointF((Width / 2), (Height / 2)), SF) End Sub Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs) Hovering = True Invalidate() MyBase.OnMouseEnter(e) End Sub Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs) Hovering = False Pressed = False Invalidate() MyBase.OnMouseLeave(e) End Sub Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs) Pressed = True Invalidate() MyBase.OnMouseDown(e) End Sub Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs) Pressed = False Invalidate() MyBase.OnMouseUp(e) End Sub End Class Class STSwitch Inherits Control #Region "Properties" Private _Switched As Boolean Public Property Switched() As Boolean Get Return _Switched End Get Set(ByVal value As Boolean) _Switched = value Invalidate() End Set End Property Private _BackColorTop As Color, _BackColorBottom As Color, _OutlineColor As Color, _TextColor As Color, _TextBackColor As Color, _DisabledTopColor As Color, _ _DisabledBottomColor As Color, _ActivatedColor As Color, _ActivatedBackColor As Color, _DeactivatedColor As Color, _DeactivatedBackColor As Color Public Overridable Property ActivatedColor() As Color Get Return _ActivatedColor End Get Set(ByVal value As Color) _ActivatedColor = value Invalidate() End Set End Property Public Overridable Property ActivatedBackColor() As Color Get Return _ActivatedBackColor End Get Set(ByVal value As Color) _ActivatedBackColor = value Invalidate() End Set End Property Public Overridable Property DeactivatedColor() As Color Get Return _DeactivatedColor End Get Set(ByVal value As Color) _DeactivatedColor = value Invalidate() End Set End Property Public Overridable Property DeactivatedBackColor() As Color Get Return _DeactivatedBackColor End Get Set(ByVal value As Color) _DeactivatedBackColor = value Invalidate() End Set End Property Public Overridable Property DisabledTopColor() As Color Get Return _DisabledTopColor End Get Set(ByVal value As Color) _DisabledTopColor = value Invalidate() End Set End Property Public Overridable Property DisabledBottomColor() As Color Get Return _DisabledBottomColor End Get Set(ByVal value As Color) _DisabledBottomColor = value Invalidate() End Set End Property Public Overridable Property TextColor() As Color Get Return _TextColor End Get Set(ByVal value As Color) _TextColor = value Invalidate() End Set End Property Public Overridable Property TextBackColor() As Color Get Return _TextBackColor End Get Set(ByVal value As Color) _TextBackColor = value Invalidate() End Set End Property Public Overridable Property OutlineColor() As Color Get Return _OutlineColor End Get Set(ByVal value As Color) _OutlineColor = value Invalidate() End Set End Property Public Overridable Property BackColorTop() As Color Get Return _BackColorTop End Get Set(ByVal value As Color) _BackColorTop = value Invalidate() End Set End Property Public Overridable Property BackColorBottom() As Color Get Return _BackColorBottom End Get Set(ByVal value As Color) _BackColorBottom = value Invalidate() End Set End Property Private _Radius As Integer = 3, _OutlineThickness As Integer = 1 Public Overridable Property Radius() As Integer Get Return _Radius End Get Set(ByVal value As Integer) _Radius = value Invalidate() End Set End Property Public Overridable Property OutlineThickness() As Integer Get Return _OutlineThickness End Get Set(ByVal value As Integer) _OutlineThickness = value Invalidate() End Set End Property _ Public Overrides Property RightToLeft() As RightToLeft Get Return MyBase.RightToLeft End Get Set(ByVal value As RightToLeft) MyBase.RightToLeft = value End Set End Property _ Public Shadows Property UseWaitCursor() As Boolean Get Return MyBase.UseWaitCursor End Get Set(ByVal value As Boolean) MyBase.UseWaitCursor = value End Set End Property _ Public Shadows Property TabIndex() As Integer Get Return MyBase.TabIndex End Get Set(ByVal value As Integer) MyBase.TabIndex = value End Set End Property _ Public Shadows Property TabStop() As Boolean Get Return MyBase.TabStop End Get Set(ByVal value As Boolean) MyBase.TabStop = value End Set End Property _ Public Overrides Property MinimumSize() As Size Get Return MyBase.MinimumSize End Get Set(ByVal value As Size) MyBase.MinimumSize = value End Set End Property _ Public Overrides Property MaximumSize() As Size Get Return MyBase.MaximumSize End Get Set(ByVal value As Size) MyBase.MaximumSize = value End Set End Property _ Public Shadows Property ImeMode() As ImeMode Get Return MyBase.ImeMode End Get Set(ByVal value As ImeMode) MyBase.ImeMode = value End Set End Property _ Public Overrides Property BackgroundImage() As Image Get Return MyBase.BackgroundImage End Get Set(ByVal value As Image) MyBase.BackgroundImage = value End Set End Property _ Public Overrides Property BackgroundImageLayout() As ImageLayout Get Return MyBase.BackgroundImageLayout End Get Set(ByVal value As ImageLayout) MyBase.BackgroundImageLayout = value End Set End Property _ Public Overrides Property Dock() As DockStyle Get Return MyBase.Dock End Get Set(ByVal value As DockStyle) MyBase.Dock = value End Set End Property _ Public Shadows Property CausesValidation() As Boolean Get Return MyBase.CausesValidation End Get Set(ByVal value As Boolean) MyBase.CausesValidation = value End Set End Property _ Public Overrides Property ContextMenuStrip() As ContextMenuStrip Get Return MyBase.ContextMenuStrip End Get Set(ByVal value As ContextMenuStrip) MyBase.ContextMenuStrip = value End Set End Property #End Region Public Sub New() Cursor = Cursors.Hand Font = New Font("Verdana", 6, FontStyle.Regular) OutlineColor = Color.FromArgb(30, 30, 30) BackColorTop = Color.FromArgb(60, 60, 60) BackColorBottom = Color.FromArgb(40, 40, 40) ActivatedColor = Color.LimeGreen ActivatedBackColor = Color.DarkGreen DeactivatedColor = Color.Red DeactivatedBackColor = Color.DarkRed TextColor = Color.White TextBackColor = Color.Black MinimumSize = New Size(40, 15) Size = MinimumSize MaximumSize = Size End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) e.Graphics.Clear(Parent.BackColor) NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 2, Width, (Height - 4)), Radius, New Pen(OutlineColor, OutlineThickness), NetTwist.CreateGradient(Width, Height, BackColorTop, BackColorBottom)) If Enabled Then If Switched Then NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle((Width / 2), 0, (Width / 2), Height), Radius, New Pen(OutlineColor, OutlineThickness), NetTwist.CreateGradient(Width, Height, ActivatedColor, ActivatedBackColor)) NetTwist.DrawString(e.Graphics, Font, "On", TextColor, StringAlignment.Near, New PointF(2, 3)) Else NetTwist.DrawRoundRectangle(e.Graphics, New Rectangle(0, 0, (Width / 2), Height), Radius, New Pen(OutlineColor, OutlineThickness), NetTwist.CreateGradient(Width, Height, DeactivatedColor, DeactivatedBackColor)) NetTwist.DrawString(e.Graphics, Font, "Off", TextColor, StringAlignment.Near, New PointF(((Width / 2) + 2), 3)) End If End If End Sub Protected Overrides Sub OnMouseClick(ByVal e As MouseEventArgs) If e.Button = MouseButtons.Left Then Switched = Not Switched End If MyBase.OnMouseClick(e) End Sub End Class