Code:
'Creator: Aeonhack
'Date: January, 2nd, 2011
'Site: EliteVS.net
'Name: Fusion Theme
'Version: 1.0
Imports System.Drawing.Drawing2D
Class FTheme
Inherits ContainerControl
Private _Resizeable As Boolean = True
Public Property Resizeable() As Boolean
Get
Return _Resizeable
End Get
Set(ByVal value As Boolean)
_Resizeable = value
End Set
End Property
Sub New()
SetStyle(DirectCast(8198, ControlStyles), True)
C = New Pigment() { _
New Pigment("Border", Color.Black), _
New Pigment("Frame", 47, 47, 50), _
New Pigment("Border Highlight", 15, 255, 255, 255), _
New Pigment("Side Highlight", 6, 255, 255, 255), _
New Pigment("Shine", 20, 255, 255, 255), _
New Pigment("Shadow", 38, 38, 40), _
New Pigment("Backcolor", 247, 247, 251), _
New Pigment("Transparency", Color.Fuchsia) _
}
End Sub
Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
Dock = DockStyle.Fill
If TypeOf Parent Is Form Then DirectCast(Parent, Form).FormBorderStyle = FormBorderStyle.None
Colors = C
MyBase.OnHandleCreated(e)
End Sub
Const Count As Byte = 8
Private C As Pigment()
Public Property Colors() As Pigment()
Get
Return C
End Get
Set(ByVal v As Pigment())
If v.Length <> Count Then Throw New IndexOutOfRangeException
P1 = New Pen(v(0).Value)
P2 = New Pen(v(2).Value)
B1 = New SolidBrush(v(6).Value)
B2 = New SolidBrush(v(7).Value)
If Parent IsNot Nothing Then
Parent.BackColor = v(6).Value
If TypeOf Parent Is Form Then DirectCast(Parent, Form).TransparencyKey = v(7).Value
End If
CB = New ColorBlend
CB.Colors = New Color() {Color.Transparent, v(4).Value, Color.Transparent}
CB.Positions = New Single() {0, 0.5, 1}
C = v
Invalidate()
End Set
End Property
Private P1, P2, P3 As Pen
Private B1, B2 As SolidBrush, B3, B4 As LinearGradientBrush
Private R1, R2 As Rectangle
Private CB As ColorBlend
Private G As Graphics, B As Bitmap
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
B = New Bitmap(Width, Height)
G = Graphics.FromImage(B)
G.Clear(C(1).Value)
G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))
G.DrawRectangle(P2, New Rectangle(12, 40, Width - 24, Height - 52))
R1 = New Rectangle(1, 0, 15, Height)
B3 = New LinearGradientBrush(R1, C(3).Value, Color.Transparent, 90.0F)
G.FillRectangle(B3, R1)
G.FillRectangle(B3, New Rectangle(Width - 16, 0, 15, Height))
G.FillRectangle(B1, New Rectangle(13, 41, Width - 26, Height - 54))
R2 = New Rectangle(0, 2, Width, 2)
B4 = New LinearGradientBrush(R2, Color.Empty, Color.Empty, 0)
B4.InterpolationColors = CB
G.FillRectangle(B4, R2)
G.DrawRectangle(P1, New Rectangle(13, 41, Width - 26, Height - 54))
G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))
G.FillRectangle(B2, New Rectangle(0, 0, 2, 2))
G.FillRectangle(B2, New Rectangle(Width - 2, 0, 2, 2))
G.FillRectangle(B2, New Rectangle(Width - 2, Height - 2, 2, 2))
G.FillRectangle(B2, New Rectangle(0, Height - 2, 2, 2))
B.SetPixel(1, 1, Color.Black)
B.SetPixel(Width - 2, 1, Color.Black)
B.SetPixel(Width - 2, Height - 2, Color.Black)
B.SetPixel(1, Height - 2, Color.Black)
e.Graphics.DrawImage(B, 0, 0)
B3.Dispose()
B4.Dispose()
G.Dispose()
B.Dispose()
End Sub
Enum Direction As Integer
NONE = 0
LEFT = 10
RIGHT = 11
TOP = 12
TOPLEFT = 13
TOPRIGHT = 14
BOTTOM = 15
BOTTOMLEFT = 16
BOTTOMRIGHT = 17
End Enum
Private Current As Direction
Sub SetCurrent()
Dim T As Point = PointToClient(MousePosition)
If T.X < 7 And T.Y < 7 Then
Current = Direction.TOPLEFT
Cursor = Cursors.SizeNWSE
ElseIf T.X < 7 And T.Y > Height - 7 Then
Current = Direction.BOTTOMLEFT
Cursor = Cursors.SizeNESW
ElseIf T.X > Width - 7 And T.Y > Height - 7 Then
Current = Direction.BOTTOMRIGHT
Cursor = Cursors.SizeNWSE
ElseIf T.X > Width - 7 And T.Y < 7 Then
Current = Direction.TOPRIGHT
Cursor = Cursors.SizeNESW
ElseIf T.X < 7 Then
Current = Direction.LEFT
Cursor = Cursors.SizeWE
ElseIf T.X > Width - 7 Then
Current = Direction.RIGHT
Cursor = Cursors.SizeWE
ElseIf T.Y < 7 Then
Current = Direction.TOP
Cursor = Cursors.SizeNS
ElseIf T.Y > Height - 7 Then
Current = Direction.BOTTOM
Cursor = Cursors.SizeNS
Else
Current = Direction.NONE
Cursor = Cursors.Default
End If
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
If e.Button = MouseButtons.Left Then
If TypeOf Parent Is Form Then
If DirectCast(Parent, Form).WindowState = FormWindowState.Maximized Then Return
End If
If Drag.Contains(e.Location) Then
Capture = False
DefWndProc(Message.Create(Parent.Handle, 161, New IntPtr(2), Nothing))
Else
If Current <> Direction.NONE And _Resizeable Then
Capture = False
DefWndProc(Message.Create(Parent.Handle, 161, New IntPtr(Current), Nothing))
End If
End If
End If
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
If _Resizeable Then SetCurrent()
MyBase.OnMouseMove(e)
End Sub
Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
Invalidate()
MyBase.OnSizeChanged(e)
End Sub
Private ReadOnly Property Drag() As Rectangle
Get
Return New Rectangle(7, 7, Width - 14, 35)
End Get
End Property
End Class
Class FButton
Inherits Control
Private Shadow_ As Boolean = True
Public Property Shadow() As Boolean
Get
Return Shadow_
End Get
Set(ByVal value As Boolean)
Shadow_ = value
Invalidate()
End Set
End Property
Sub New()
SetStyle(DirectCast(8198, ControlStyles), True)
Colors = New Pigment() {New Pigment("Border", 254, 133, 0), New Pigment("Backcolor", 247, 247, 251), _
New Pigment("Highlight", 255, 197, 19), New Pigment("Gradient1", 255, 175, 12), _
New Pigment("Gradient2", 255, 127, 1), New Pigment("Text Color", Color.White), _
New Pigment("Text Shadow", 30, 0, 0, 0)}
Font = New Font("Verdana", 8)
End Sub
Const Count As Byte = 7
Private C As Pigment()
Public Property Colors() As Pigment()
Get
Return C
End Get
Set(ByVal v As Pigment())
If v.Length <> Count Then Throw New IndexOutOfRangeException
P1 = New Pen(v(0).Value)
P2 = New Pen(v(2).Value)
B1 = New SolidBrush(v(6).Value)
B2 = New SolidBrush(v(5).Value)
C = v
Invalidate()
End Set
End Property
Private P1, P2 As Pen
Private B1, B2 As SolidBrush, B3 As LinearGradientBrush
Private SZ As Size, PT As Point
Private G As Graphics, B As Bitmap
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
B = New Bitmap(Width, Height)
G = Graphics.FromImage(B)
If Down Then
B3 = New LinearGradientBrush(ClientRectangle, C(4).Value, C(3).Value, 90.0F)
Else
B3 = New LinearGradientBrush(ClientRectangle, C(3).Value, C(4).Value, 90.0F)
End If
G.FillRectangle(B3, ClientRectangle)
If Not String.IsNullOrEmpty(Text) Then
SZ = G.MeasureString(Text, Font).ToSize
PT = New Point(CInt(Width / 2 - SZ.Width / 2), CInt(Height / 2 - SZ.Height / 2))
If Shadow_ Then G.DrawString(Text, Font, B1, PT.X + 1, PT.Y + 1)
G.DrawString(Text, Font, B2, PT)
End If
G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))
G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))
B.SetPixel(0, 0, C(1).Value)
B.SetPixel(Width - 1, 0, C(1).Value)
B.SetPixel(Width - 1, Height - 1, C(1).Value)
B.SetPixel(0, Height - 1, C(1).Value)
e.Graphics.DrawImage(B, 0, 0)
B3.Dispose()
G.Dispose()
B.Dispose()
End Sub
Private Down As Boolean
Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Button = MouseButtons.Left Then
Down = True
Invalidate()
End If
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
Down = False
Invalidate()
MyBase.OnMouseUp(e)
End Sub
End Class
Class FProgressBar
Inherits Control
Private _Maximum As Double = 100
Public Property Maximum() As Double
Get
Return _Maximum
End Get
Set(ByVal v As Double)
_Maximum = v
Progress = _Current / v * 100
End Set
End Property
Private _Current As Double
Public Property Current() As Double
Get
Return _Current
End Get
Set(ByVal v As Double)
Progress = v / _Maximum * 100
End Set
End Property
Private _Progress As Double
Public Property Progress() As Double
Get
Return _Progress
End Get
Set(ByVal v As Double)
If v < 0 Then v = 0 Else If v > 100 Then v = 100
_Progress = v
_Current = v * 0.01 * _Maximum
Invalidate()
End Set
End Property
Sub New()
SetStyle(DirectCast(8198, ControlStyles), True)
Colors = New Pigment() { _
New Pigment("Border", 214, 214, 216), New Pigment("Backcolor1", 247, 247, 251), _
New Pigment("Backcolor2", 239, 239, 242), New Pigment("Highlight", 100, 255, 255, 255), _
New Pigment("Forecolor", 224, 224, 224), New Pigment("Gloss", 130, 255, 255, 255)}
End Sub
Const Count As Byte = 6
Private C As Pigment()
Public Property Colors() As Pigment()
Get
Return C
End Get
Set(ByVal v As Pigment())
If v.Length <> Count Then Throw New IndexOutOfRangeException
P1 = New Pen(v(0).Value)
P2 = New Pen(v(3).Value)
B1 = New SolidBrush(v(4).Value)
CB = New ColorBlend
CB.Colors = New Color() {v(5).Value, Color.Transparent, Color.Transparent}
CB.Positions = New Single() {0, 0.3, 1}
C = v
Invalidate()
End Set
End Property
Private P1, P2 As Pen
Private B1 As SolidBrush, B2 As LinearGradientBrush
Private CB As ColorBlend
Private G As Graphics, B As Bitmap
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
B = New Bitmap(Width, Height)
G = Graphics.FromImage(B)
G.Clear(C(2).Value)
G.FillRectangle(B1, New Rectangle(1, 1, CInt((Width * _Progress * 0.01) - 2), Height - 2))
B2 = New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 90.0F)
B2.InterpolationColors = CB
G.FillRectangle(B2, ClientRectangle)
G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))
G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))
B.SetPixel(0, 0, C(1).Value)
B.SetPixel(Width - 1, 0, C(1).Value)
B.SetPixel(Width - 1, Height - 1, C(1).Value)
B.SetPixel(0, Height - 1, C(1).Value)
e.Graphics.DrawImage(B, 0, 0)
B2.Dispose()
G.Dispose()
B.Dispose()
End Sub
Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
Invalidate()
MyBase.OnSizeChanged(e)
End Sub
End Class
Class Pigment
Private _Name As String = "Pigment"
Property Name() As String
Get
Return _name
End Get
Set(ByVal v As String)
_name = v
End Set
End Property
Private _Value As Color = Color.Black
Public Property Value() As Color
Get
Return _Value
End Get
Set(ByVal value As Color)
_Value = value
End Set
End Property
Sub New()
End Sub
Sub New(ByVal n As String, ByVal v As Color)
Name = n
Value = v
End Sub
Sub New(ByVal n As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
Name = n
Value = Color.FromArgb(a, r, g, b)
End Sub
Sub New(ByVal n As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
Name = n
Value = Color.FromArgb(r, g, b)
End Sub
End Class
Credits to Aeonhack