Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
[yt]http://www.youtube.com/watch?v=zhq2WACiCyc[/yt]
I created my own theme recently, but one of the things that makes mine unique is that it acts a bit like WPF for it's ability to customize different parts of a control. So far I only have the button border down, and I haven't done much with the theme yet, but this is going to be one good theme when i'm done with it.
The best part about allowing it to be user configured is that the control's visual custom setting for the border will stay even upon runtime.
I do this by creating my own entry in the properties area, and the value gets taken from the selected user input.
Right now I just added a few basic colors here and there, and got a gradient on my progress bar.
Posts: 3,538
Threads: 348
Joined: Mar 2010
Reputation:
57
I've done something similar to this in the past. It is a lot of fun to play around with, although I only really focused on buttons & the actual form itself rather than progress bars.
Posts: 176
Threads: 20
Joined: Jun 2011
Reputation:
4
Release? I wanna try it out ;)
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
I'm finished, i'll let the comments flow in before I release the class though for a little while
[yt]http://www.youtube.com/watch?v=vF394hE0nv8[/yt]
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
Released:
Code: 'Ace Skytheme v1.0
'©2011
'Created by Ace - TechLifeForum.net
'Please give me credits for the theme, I would highly appreciate it for my time into this
'This is only a beginning version, More will be added in future releases
Imports System.Drawing.Drawing2D
Imports System.ComponentModel
Imports System.Runtime.InteropServices
MustInherit Class Theme
Inherits ContainerControl
#Region " Initialization "
Protected G As Graphics
Sub New()
SetStyle(DirectCast(139270, ControlStyles), True)
End Sub
Private ParentIsForm As Boolean
Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
Dock = DockStyle.Fill
ParentIsForm = TypeOf Parent Is Form
If ParentIsForm Then
If Not _TransparencyKey = Color.Empty Then ParentForm.TransparencyKey = _TransparencyKey
ParentForm.FormBorderStyle = FormBorderStyle.None
End If
MyBase.OnHandleCreated(e)
End Sub
Overrides Property Text As String
Get
Return MyBase.Text
End Get
Set(ByVal v As String)
MyBase.Text = v
Invalidate()
End Set
End Property
#End Region
#Region " Sizing and Movement "
Private _Resizable As Boolean = True
Property Resizable() As Boolean
Get
Return _Resizable
End Get
Set(ByVal value As Boolean)
_Resizable = value
End Set
End Property
Private _MoveHeight As Integer = 24
Property MoveHeight() As Integer
Get
Return _MoveHeight
End Get
Set(ByVal v As Integer)
_MoveHeight = v
Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
End Set
End Property
Private Flag As IntPtr
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
If Not e.Button = MouseButtons.Left Then Return
If ParentIsForm Then If ParentForm.WindowState = FormWindowState.Maximized Then Return
If Header.Contains(e.Location) Then
Flag = New IntPtr(2)
ElseIf Current.Position = 0 Or Not _Resizable Then
Return
Else
Flag = New IntPtr(Current.Position)
End If
Capture = False
DefWndProc(Message.Create(Parent.Handle, 161, Flag, Nothing))
MyBase.OnMouseDown(e)
End Sub
Private Structure Pointer
ReadOnly Cursor As Cursor, Position As Byte
Sub New(ByVal c As Cursor, ByVal p As Byte)
Cursor = c
Position = p
End Sub
End Structure
Private F1, F2, F3, F4 As Boolean, PTC As Point
Private Function GetPointer() As Pointer
PTC = PointToClient(MousePosition)
F1 = PTC.X < 7
F2 = PTC.X > Width - 7
F3 = PTC.Y < 7
F4 = PTC.Y > Height - 7
If F1 And F3 Then Return New Pointer(Cursors.SizeNWSE, 13)
If F1 And F4 Then Return New Pointer(Cursors.SizeNESW, 16)
If F2 And F3 Then Return New Pointer(Cursors.SizeNESW, 14)
If F2 And F4 Then Return New Pointer(Cursors.SizeNWSE, 17)
If F1 Then Return New Pointer(Cursors.SizeWE, 10)
If F2 Then Return New Pointer(Cursors.SizeWE, 11)
If F3 Then Return New Pointer(Cursors.SizeNS, 12)
If F4 Then Return New Pointer(Cursors.SizeNS, 15)
Return New Pointer(Cursors.Default, 0)
End Function
Private Current, Pending As Pointer
Private Sub SetCurrent()
Pending = GetPointer()
If Current.Position = Pending.Position Then Return
Current = GetPointer()
Cursor = Current.Cursor
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
If _Resizable Then SetCurrent()
MyBase.OnMouseMove(e)
End Sub
Protected Header As Rectangle
Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
If Width = 0 OrElse Height = 0 Then Return
Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
Invalidate()
MyBase.OnSizeChanged(e)
End Sub
#End Region
#Region " Convienence "
MustOverride Sub PaintHook()
Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
If Width = 0 OrElse Height = 0 Then Return
G = e.Graphics
PaintHook()
End Sub
Private _TransparencyKey As Color
Property TransparencyKey() As Color
Get
Return _TransparencyKey
End Get
Set(ByVal v As Color)
_TransparencyKey = v
Invalidate()
End Set
End Property
Private _Image As Image
Property Image() As Image
Get
Return _Image
End Get
Set(ByVal value As Image)
_Image = value
Invalidate()
End Set
End Property
ReadOnly Property ImageWidth() As Integer
Get
If _Image Is Nothing Then Return 0
Return _Image.Width
End Get
End Property
Private _Size As Size
Private _Rectangle As Rectangle
Private _Gradient As LinearGradientBrush
Private _Brush As SolidBrush
Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
_Brush = New SolidBrush(c)
G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1)
G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1)
G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1)
G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
End Sub
Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
DrawText(a, c, x, 0)
End Sub
Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
If String.IsNullOrEmpty(Text) Then Return
_Size = G.MeasureString(Text, Font).ToSize
_Brush = New SolidBrush(c)
Select Case a
Case HorizontalAlignment.Left
G.DrawString(Text, Font, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
Case HorizontalAlignment.Right
G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
Case HorizontalAlignment.Center
G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
End Select
End Sub
Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
DrawIcon(a, x, 0)
End Sub
Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
If _Image Is Nothing Then Return
Select Case a
Case HorizontalAlignment.Left
G.DrawImage(_Image, x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
Case HorizontalAlignment.Right
G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
Case HorizontalAlignment.Center
G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, _MoveHeight \ 2 - _Image.Height \ 2)
End Select
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
_Rectangle = New Rectangle(x, y, width, height)
_Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
G.FillRectangle(_Gradient, _Rectangle)
End Sub
#End Region
End Class
MustInherit Class ThemeControl
Inherits Control
#Region " Initialization "
Protected G As Graphics, B As Bitmap
Sub New()
SetStyle(DirectCast(139270, ControlStyles), True)
B = New Bitmap(1, 1)
G = Graphics.FromImage(B)
End Sub
Sub AllowTransparent()
SetStyle(ControlStyles.Opaque, False)
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
End Sub
Overrides Property Text As String
Get
Return MyBase.Text
End Get
Set(ByVal v As String)
MyBase.Text = v
Invalidate()
End Set
End Property
#End Region
#Region " Mouse Handling "
Protected Enum State As Byte
MouseNone = 0
MouseOver = 1
MouseDown = 2
End Enum
Protected MouseState As State
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
ChangeMouseState(State.MouseNone)
MyBase.OnMouseLeave(e)
End Sub
Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
ChangeMouseState(State.MouseOver)
MyBase.OnMouseEnter(e)
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
ChangeMouseState(State.MouseOver)
MyBase.OnMouseUp(e)
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
If e.Button = MouseButtons.Left Then ChangeMouseState(State.MouseDown)
MyBase.OnMouseDown(e)
End Sub
Private Sub ChangeMouseState(ByVal e As State)
MouseState = e
Invalidate()
End Sub
#End Region
#Region " Convienence "
MustOverride Sub PaintHook()
Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
If Width = 0 OrElse Height = 0 Then Return
PaintHook()
e.Graphics.DrawImage(B, 0, 0)
End Sub
Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
If Not Width = 0 AndAlso Not Height = 0 Then
B = New Bitmap(Width, Height)
G = Graphics.FromImage(B)
Invalidate()
End If
MyBase.OnSizeChanged(e)
End Sub
Private _NoRounding As Boolean
Property NoRounding() As Boolean
Get
Return _NoRounding
End Get
Set(ByVal v As Boolean)
_NoRounding = v
Invalidate()
End Set
End Property
Private _Image As Image
Property Image() As Image
Get
Return _Image
End Get
Set(ByVal value As Image)
_Image = value
Invalidate()
End Set
End Property
ReadOnly Property ImageWidth() As Integer
Get
If _Image Is Nothing Then Return 0
Return _Image.Width
End Get
End Property
ReadOnly Property ImageTop() As Integer
Get
If _Image Is Nothing Then Return 0
Return Height \ 2 - _Image.Height \ 2
End Get
End Property
Private _Size As Size
Private _Rectangle As Rectangle
Private _Gradient As LinearGradientBrush
Private _Brush As SolidBrush
Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
If _NoRounding Then Return
B.SetPixel(rect.X, rect.Y, c)
B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
End Sub
Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
DrawText(a, c, x, 0)
End Sub
Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
If String.IsNullOrEmpty(Text) Then Return
_Size = G.MeasureString(Text, Font).ToSize
_Brush = New SolidBrush(c)
Select Case a
Case HorizontalAlignment.Left
G.DrawString(Text, Font, _Brush, x, Height \ 2 - _Size.Height \ 2 + y)
Case HorizontalAlignment.Right
G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height \ 2 - _Size.Height \ 2 + y)
Case HorizontalAlignment.Center
G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, Height \ 2 - _Size.Height \ 2 + y)
End Select
End Sub
Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
DrawIcon(a, x, 0)
End Sub
Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
If _Image Is Nothing Then Return
Select Case a
Case HorizontalAlignment.Left
G.DrawImage(_Image, x, Height \ 2 - _Image.Height \ 2 + y)
Case HorizontalAlignment.Right
G.DrawImage(_Image, Width - _Image.Width - x, Height \ 2 - _Image.Height \ 2 + y)
Case HorizontalAlignment.Center
G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, Height \ 2 - _Image.Height \ 2)
End Select
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
_Rectangle = New Rectangle(x, y, width, height)
_Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
G.FillRectangle(_Gradient, _Rectangle)
End Sub
#End Region
End Class
MustInherit Class ThemeContainerControl
Inherits ContainerControl
#Region " Initialization "
Protected G As Graphics, B As Bitmap
Sub New()
SetStyle(DirectCast(139270, ControlStyles), True)
B = New Bitmap(1, 1)
G = Graphics.FromImage(B)
End Sub
Sub AllowTransparent()
SetStyle(ControlStyles.Opaque, False)
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
End Sub
#End Region
#Region " Convienence "
MustOverride Sub PaintHook()
Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
If Width = 0 OrElse Height = 0 Then Return
PaintHook()
e.Graphics.DrawImage(B, 0, 0)
End Sub
Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
If Not Width = 0 AndAlso Not Height = 0 Then
B = New Bitmap(Width, Height)
G = Graphics.FromImage(B)
Invalidate()
End If
MyBase.OnSizeChanged(e)
End Sub
Private _NoRounding As Boolean
Property NoRounding() As Boolean
Get
Return _NoRounding
End Get
Set(ByVal v As Boolean)
_NoRounding = v
Invalidate()
End Set
End Property
Private _Rectangle As Rectangle
Private _Gradient As LinearGradientBrush
Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
If _NoRounding Then Return
B.SetPixel(rect.X, rect.Y, c)
B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
_Rectangle = New Rectangle(x, y, width, height)
_Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
G.FillRectangle(_Gradient, _Rectangle)
End Sub
#End Region
End Class
Class AceTheme
Inherits Theme
#Region "Background Color"
Private BackgroundColor As Color = Color.Black
<Description("Set the background color for the form"), Category("Custom Form Color"), _
DisplayName("Background")>
Public Property BackColorInput() As Color
Get
Return BackgroundColor
End Get
Set(ByVal value As Color)
BackgroundColor = value
Invalidate()
End Set
End Property
#End Region
#Region "Top Gradient"
Private TitleBarTopGRD As Color = Color.FromArgb(0, 175, 255)
<Description("Set the top gradient for the titlebar"), Category("Custom Form Color"), _
DisplayName("Titlebar Top Gradient")>
Public Property TitleBarTopGradient() As Color
Get
Return TitleBarTopGRD
End Get
Set(ByVal value As Color)
TitleBarTopGRD = value
Invalidate()
End Set
End Property
#End Region
#Region "Bottom Gradient"
Private TitleBarBottomGRD As Color = Color.FromArgb(128, 255, 255)
<Description("Set the bottom gradient for the titlebar"), Category("Custom Form Color"), _
DisplayName("Titlebar Bottom Gradient")>
Public Property TitleBarBottomGradient() As Color
Get
Return TitleBarBottomGRD
End Get
Set(ByVal value As Color)
TitleBarBottomGRD = value
Invalidate()
End Set
End Property
#End Region
Sub New()
BackColor = BackgroundColor
MoveHeight = 25
TransparencyKey = Color.Fuchsia
End Sub
Overrides Sub PaintHook()
G.Clear(BackgroundColor)
'For Titlebar
DrawGradient(TitleBarTopGRD, TitleBarBottomGRD, 0, 0, Width, 25, 90S)
Dim BorderCol As Pen
BorderCol = New Pen(TitleBarBottomGRD)
G.DrawRectangle(BorderCol, 2, 25, Width - 5, Height - 28)
DrawText(HorizontalAlignment.Left, Color.Black, 10, 2)
DrawBorders(Pens.Black, Pens.LightBlue, ClientRectangle)
DrawCorners(Color.Fuchsia, ClientRectangle)
'G.DrawIcon(SystemIcons.Information, 30, 40)
End Sub
End Class
Class AceButton
Inherits ThemeControl
#Region "Border Color"
Private BorderColor As Color = Color.SkyBlue
<Description("Set the border color for a button"), Category("Custom Button Color"), _
DisplayName("Border")>
Public Property ColorInput() As Color
Get
Return BorderColor
End Get
Set(ByVal value As Color)
BorderColor = value
Invalidate()
End Set
End Property
#End Region
#Region "Background Color"
Private BackgroundColor As Color = Color.Black
<Description("Set the background color for a button"), Category("Custom Button Color"), _
DisplayName("Background")>
Public Property BackgroundColInput() As Color
Get
Return BackgroundColor
End Get
Set(ByVal value As Color)
BackgroundColor = value
Invalidate()
End Set
End Property
#End Region
#Region "Inactive Top Gradient"
Private InactiveTopGRD As Color = Color.FromArgb(192, 255, 255)
<Description("Set the top gradient color for the button"), Category("Custom Button Color"), _
DisplayName("Inactive Top Gradient")>
Public Property InactiveTopGradient() As Color
Get
Return InactiveTopGRD
End Get
Set(ByVal value As Color)
InactiveTopGRD = value
Invalidate()
End Set
End Property
#End Region
#Region "Inactive Bottom Gradient"
Private InactiveBottomGRD As Color = Color.DeepSkyBlue
<Description("Set the bottom gradient color for the button"), Category("Custom Button Color"), _
DisplayName("Inactive Bottom Gradient")>
Public Property InactiveBottomGradient() As Color
Get
Return InactiveBottomGRD
End Get
Set(ByVal value As Color)
InactiveBottomGRD = value
Invalidate()
End Set
End Property
#End Region
#Region "Active Top Gradient"
Private ActiveTopGRD As Color = Color.DeepSkyBlue
<Description("Set the top gradient color for the button for the appearance of the button when it is pressed"), _
Category("Custom Button Color"), _
DisplayName("Active Top Gradient")>
Public Property ActiveTopGradient() As Color
Get
Return ActiveTopGRD
End Get
Set(ByVal value As Color)
ActiveTopGRD = value
Invalidate()
End Set
End Property
#End Region
#Region "Active Bottom Gradient"
Private ActiveBottomGRD As Color = Color.FromArgb(192, 255, 255)
<Description("Set the bottom gradient color for the button for the appearance of the button when it is pressed"), _
Category("Custom Button Color"), _
DisplayName("Active Bottom Gradient")>
Public Property ActiveBottomGradient() As Color
Get
Return ActiveBottomGRD
End Get
Set(ByVal value As Color)
ActiveBottomGRD = value
Invalidate()
End Set
End Property
#End Region
Sub New()
AllowTransparent()
End Sub
Public Overrides Sub PaintHook()
G.Clear(Color.SkyBlue)
If MouseState = State.MouseNone Then
DrawGradient(InactiveTopGRD, InactiveBottomGRD, 0, 0, Width, Height, 90S)
ElseIf MouseState = State.MouseOver Then
DrawGradient(InactiveTopGRD, InactiveBottomGRD, 0, 0, Width, Height, 90S)
ElseIf MouseState = State.MouseDown Then
DrawGradient(ActiveTopGRD, ActiveBottomGRD, 0, 0, Width, Height, 90S)
End If
DrawText(HorizontalAlignment.Center, Color.Black, 0, 0)
Dim BorderCol As Pen
BorderCol = New Pen(BorderColor)
DrawBorders(BorderCol, BorderCol, ClientRectangle)
DrawCorners(BackgroundColor, ClientRectangle)
End Sub
End Class
Class AceProgressBar
Inherits ThemeControl
#Region "Maximum Value"
Private MaxValue As Integer = 100
<Description("Set the maximum value of the ProgressBar"), Category("Ace's Custom ProgressBar"), _
DisplayName("Max Value")>
Public Property Maximum() As Integer
Get
Return MaxValue
End Get
Set(ByVal ProgVal As Integer)
If ProgVal < 1 Then
ProgVal = 1
End If
If ProgVal < MaxValue Then
MaxValue = ProgVal
End If
MaxValue = ProgVal
Invalidate()
End Set
End Property
#End Region
#Region "Current Value"
Private CurrentValue As Integer = 75
<Description("Set the current value of the ProgressBar"), Category("Ace's Custom ProgressBar"), _
DisplayName("Current Value")>
Public Property ProgressBarValue() As Integer
Get
Return CurrentValue
End Get
Set(ByVal ProgVal As Integer)
If ProgVal > MaxValue Then
ProgVal = MaxValue
End If
CurrentValue = ProgVal
Invalidate()
End Set
End Property
#End Region
#Region "Border Color"
Private BorderColor As Color = Color.White
<Description("Set the border color for the progressbar"), Category("Custom Progressbar Color"), _
DisplayName("Border")>
Public Property BorderColInput() As Color
Get
Return BorderColor
End Get
Set(ByVal value As Color)
If value = Nothing Then
BorderColor = Color.White
End If
BorderColor = value
Invalidate()
End Set
End Property
#End Region
#Region "Background Color"
Private BackgroundColor As Color = Color.Black
<Description("Set the background color for the progressbar"), Category("Custom Progressbar Color"), _
DisplayName("Background")>
Public Property BackgroundColInput() As Color
Get
Return BackgroundColor
End Get
Set(ByVal value As Color)
BackgroundColor = value
Invalidate()
End Set
End Property
#End Region
#Region "First Gradient"
Private FirstGradient As Color = Color.FromArgb(0, 200, 255)
<Description("Set the first gradient for the progressbar"), Category("Custom Progressbar Color"), _
DisplayName("First Gradient")>
Public Property FirstGRD() As Color
Get
Return FirstGradient
End Get
Set(ByVal value As Color)
FirstGradient = value
Invalidate()
End Set
End Property
#End Region
#Region "Second Gradient"
Private SecondGradient As Color = Color.FromArgb(150, 225, 255)
<Description("Set the second gradient for the progressbar"), Category("Custom Progressbar Color"), _
DisplayName("Second Gradient")>
Public Property SecondGRD() As Color
Get
Return SecondGradient
End Get
Set(ByVal value As Color)
SecondGradient = value
Invalidate()
End Set
End Property
#End Region
Public Overrides Sub PaintHook()
G.Clear(BackgroundColor)
Dim BorderPen As Pen
BorderPen = New Pen(BorderColor)
G.DrawRectangle(BorderPen, 0, 0, Width - 1, Height - 1)
DrawGradient(FirstGradient, SecondGradient, 1, 1, CInt((CurrentValue / MaxValue) * Width) - 1, Height - 2, 45S)
End Sub
End Class
Posts: 3,538
Threads: 348
Joined: Mar 2010
Reputation:
57
You should allow icons to be added to the form, I have a snippet of code for that if you want it.
Other than that it looks very decent.
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
(07-29-2011, 02:33 AM)Fragma Wrote: You should allow icons to be added to the form, I have a snippet of code for that if you want it.
Other than that it looks very decent.
It's alright, I know how to do it, but thanks for the offer
I focused on the visual with the colors for the most part. Onto other things now! I'm thinking on creating various other controls as well. People only ever do the main theme, a button and a progressbar, and they stop with that for some reason.
Posts: 81
Threads: 1
Joined: Jul 2011
Reputation:
0
Hmm seems pretty simple and sleek I like it alot
Posts: 693
Threads: 59
Joined: Apr 2010
Reputation:
30
Looks good is it your first theme?
If you are willing to join SF Webmasters.
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
(07-31-2011, 06:14 AM)Kewl Wrote: Looks good is it your first theme?
No i've created a couple others, but I don't usually work on class themes like this
I work with WPF sometimes, which basically gives you everything you need anyway lol.
|