Professional Documents
Culture Documents
Drawing2D
Imports System.ComponentModel
Sub New()
SetStyle(ControlStyles.UserPaint Or
ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
ForeColor = Color.FromArgb(205, 205, 205)
DoubleBuffered = True
End Sub
MyBase.OnPaint(e)
G.Clear(BackColor)
Dim drawFont As New Font("Tahoma", 8, FontStyle.Bold)
'G.CompositingQuality = CompositingQuality.HighQuality
G.SmoothingMode = SmoothingMode.HighQuality
e.Graphics.DrawImage(B.Clone(), 0, 0)
G.Dispose() : B.Dispose()
End Sub
End Class
Public Class PerplexTheme : Inherits ContainerControl
Sub New()
SetStyle(ControlStyles.UserPaint Or
ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.FromArgb(25, 25, 25)
DoubleBuffered = True
End Sub
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim B As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(B)
Dim TopLeft As New Rectangle(0, 0, Width - 125, 28)
Dim TopRight As New Rectangle(Width - 82, 0, 81, 28)
Dim Body As New Rectangle(10, 10, Width - 21, Height - 16)
Dim Body2 As New Rectangle(5, 5, Width - 11, Height - 6)
MyBase.OnPaint(e)
G.Clear(Color.Fuchsia)
e.Graphics.DrawImage(B.Clone(), 0, 0)
G.Dispose() : B.Dispose()
End Sub
Sub New()
SetStyle(ControlStyles.UserPaint Or
ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
ForeColor = Color.FromArgb(205, 205, 205)
DoubleBuffered = True
End Sub
MyBase.OnPaint(e)
G.Clear(BackColor)
'G.CompositingQuality = CompositingQuality.HighQuality
G.SmoothingMode = SmoothingMode.HighQuality
Sub New()
SetStyle(ControlStyles.UserPaint Or
ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
End Sub
Protected Overrides Sub OnPaint(e As
System.Windows.Forms.PaintEventArgs)
Dim B As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(B)
Dim Body As New Rectangle(4, 25, Width - 9, Height - 30)
Dim Body2 As New Rectangle(0, 0, Width - 1, Height - 1)
MyBase.OnPaint(e)
G.Clear(Color.Transparent)
G.SmoothingMode = SmoothingMode.HighQuality
G.CompositingQuality = CompositingQuality.HighQuality
e.Graphics.DrawImage(B.Clone(), 0, 0)
G.Dispose() : B.Dispose()
End Sub
End Class
Public Class PerplexProgressBar : Inherits Control
Sub New()
MyBase.New()
DoubleBuffered = True
SetStyle(ControlStyles.UserPaint Or
ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
End Sub
G.SmoothingMode = SmoothingMode.HighQuality
If _ShowPercentage Then
G.DrawString(Convert.ToString(String.Concat(Value, "%")),
Font, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New
StringFormat() With {.Alignment = StringAlignment.Center,
.LineAlignment = StringAlignment.Center})
End If
e.Graphics.DrawImage(B.Clone(), 0, 0)
G.Dispose() : B.Dispose()
End Sub
End Class
<DefaultEvent("CheckedChanged")> Public Class PerplexCheckBox :
Inherits Control
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or
ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
ForeColor = Color.Black
Size = New Size(145, 16)
DoubleBuffered = True
End Sub
G.SmoothingMode = SmoothingMode.HighQuality
G.CompositingQuality = CompositingQuality.HighQuality
G.Clear(BackColor)
If Checked Then
Dim chkPoly As Rectangle = New
Rectangle(checkBoxRectangle.X + checkBoxRectangle.Width / 4,
checkBoxRectangle.Y + checkBoxRectangle.Height / 4,
checkBoxRectangle.Width \ 2, checkBoxRectangle.Height \ 2)
Dim Poly() As Point = {New Point(chkPoly.X, chkPoly.Y +
chkPoly.Height \ 2), _
New Point(chkPoly.X + chkPoly.Width \ 2,
chkPoly.Y + chkPoly.Height), _
New Point(chkPoly.X + chkPoly.Width,
chkPoly.Y)}
G.SmoothingMode = SmoothingMode.HighQuality
Dim P1 As New Pen(Color.FromArgb(12, 12, 12), 2)
Dim chkGrad As New LinearGradientBrush(chkPoly,
Color.White, Color.White, 0S)
For i = 0 To Poly.Length - 2
G.DrawLine(P1, Poly(i), Poly(i + 1))
Next
End If
e.Graphics.DrawImage(B.Clone(), 0, 0)
G.Dispose() : B.Dispose()
End Sub
End Class
<DefaultEvent("CheckedChanged")> Public Class PerplexRadioButton :
Inherits Control
Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or
ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
ForeColor = Color.Black
Size = New Size(150, 16)
DoubleBuffered = True
End Sub
G.SmoothingMode = SmoothingMode.HighQuality
G.CompositingQuality = CompositingQuality.HighQuality
G.Clear(BackColor)
If Checked Then
Dim chkGrad As New LinearGradientBrush(New Rectangle(4,
4, Height - 9, Height - 9), Color.FromArgb(250, 15, 15, 15),
Color.FromArgb(250, 15, 15, 15), 90S)
G.FillEllipse(chkGrad, New Rectangle(4, 4, Height - 9,
Height - 9))
End If
e.Graphics.DrawImage(B.Clone(), 0, 0)
G.Dispose() : B.Dispose()
End Sub
End Class
Public Class PerplexLabel : Inherits Control
Sub New()
SetStyle(ControlStyles.UserPaint Or
ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
ForeColor = Color.FromArgb(205, 205, 205)
DoubleBuffered = True
End Sub
MyBase.OnPaint(e)
G.Clear(BackColor)
Dim drawFont As New Font("Tahoma", 9, FontStyle.Bold)
G.CompositingQuality = CompositingQuality.HighQuality
G.SmoothingMode = SmoothingMode.HighQuality
e.Graphics.DrawImage(B.Clone(), 0, 0)
G.Dispose() : B.Dispose()
End Sub
End Class