Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Drawing.Drawing2D
- 'Made by AeroRev9.
- 'HackForums.
- Module Base
- Public UI As Color = Color.FromArgb(251, 98, 100)
- Public UIFont As New Font("Segoe UI", 10)
- Public Enum MouseState As Byte
- None
- Hover
- Down
- End Enum
- Public Sub RoundRect(ByVal G As Graphics, _
- ByVal X As Integer, _
- ByVal Y As Integer, _
- ByVal Width As Integer, _
- ByVal Height As Integer, _
- ByVal Curve As Integer, _
- ByVal Draw As Color)
- Dim BaseRect As New RectangleF(X, Y, Width,
- Height)
- Dim ArcRect As New RectangleF(BaseRect.Location,
- New SizeF(Curve, Curve))
- G.DrawArc(New Pen(Draw), ArcRect, 180, 90)
- G.DrawLine(New Pen(Draw), X + CInt(Curve / 2),
- Y,
- Y + Width - CInt(Curve / 2),
- Y)
- ArcRect.X = BaseRect.Right - Curve
- G.DrawArc(New Pen(Draw), ArcRect, 270, 90)
- G.DrawLine(New Pen(Draw), X + Width,
- Y + CInt(Curve / 2),
- X + Width,
- Y + Height - CInt(Curve / 2))
- ArcRect.Y = BaseRect.Bottom - Curve
- G.DrawArc(New Pen(Draw), ArcRect, 0, 90)
- G.DrawLine(New Pen(Draw), X + CInt(Curve / 2),
- Y + Height,
- X + Width - CInt(Curve / 2),
- Y + Height)
- ArcRect.X = BaseRect.Left
- G.DrawArc(New Pen(Draw), ArcRect, 90, 90)
- G.DrawLine(New Pen(Draw),
- X, Y + CInt(Curve / 2),
- X,
- Y + Height - CInt(Curve / 2))
- End Sub
- Public Sub CenterString(G As Graphics, text As String, font As Font, brush As Brush, rect As Rectangle, Optional shadow As Boolean = False, Optional yOffset As Integer = 0)
- Dim textSize As SizeF = G.MeasureString(text, font)
- Dim textX As Integer = rect.X + (rect.Width / 2) - (textSize.Width / 2)
- Dim textY As Integer = rect.Y + (rect.Height / 2) - (textSize.Height / 2) + yOffset
- If shadow Then G.DrawString(text, font, Brushes.Black, textX + 1, textY + 1)
- G.DrawString(text, font, brush, textX, textY + 1)
- End Sub
- Public Sub DrawTriangle(G As Graphics, Rect As Rectangle, Draw As Color)
- Dim halfWidth As Integer = Rect.Width / 2
- Dim halfHeight As Integer = Rect.Height / 2
- Dim p0 As Point = Point.Empty
- Dim p1 As Point = Point.Empty
- Dim p2 As Point = Point.Empty
- p0 = New Point(Rect.Left + halfWidth, Rect.Bottom)
- p1 = New Point(Rect.Left, Rect.Top)
- p2 = New Point(Rect.Right, Rect.Top)
- G.FillPolygon(New SolidBrush(Draw), New Point() {p0, p1, p2})
- End Sub
- End Module
- Class KingwoodForm
- Inherits ContainerControl
- Sub New()
- BackColor = Color.FromArgb(227, 227, 227)
- Dock = DockStyle.Fill
- Font = New Font("Segoe UI", 10)
- End Sub
- End Class
- Class KingwoodButton
- Inherits Button
- Private State As MouseState
- Protected Overrides Sub OnCreateControl()
- MyBase.OnCreateControl()
- SetStyle(ControlStyles.UserPaint, True)
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
- MyBase.OnPaint(e)
- G.Clear(Color.FromArgb(227, 227, 227))
- Select Case State
- Case MouseState.Down
- G.FillRectangle(New SolidBrush(Color.FromArgb(240, 87, 89)), New Rectangle(1, 1, Width - 2, Height - 2))
- RoundRect(G, 0, 0, Width - 1, Height - 1, 2, Color.FromArgb(240, 87, 89))
- Case MouseState.Hover
- G.FillRectangle(New SolidBrush(Color.FromArgb(255, 102, 104)), New Rectangle(1, 1, Width - 2, Height - 2))
- RoundRect(G, 0, 0, Width - 1, Height - 1, 2, Color.FromArgb(255, 102, 104))
- Case Else
- G.FillRectangle(New SolidBrush(UI), New Rectangle(1, 1, Width - 2, Height - 2))
- RoundRect(G, 0, 0, Width - 1, Height - 1, 2, UI)
- End Select
- CenterString(G, Text, UIFont, Brushes.White, New Rectangle(0, 0, Width, Height))
- End Sub
- Protected Overrides Sub OnMouseEnter(e As EventArgs)
- MyBase.OnMouseEnter(e)
- State = MouseState.Hover : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseLeave(e As EventArgs)
- MyBase.OnMouseLeave(e)
- State = MouseState.None : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
- MyBase.OnMouseDown(e)
- State = MouseState.Down : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
- MyBase.OnMouseUp(e)
- State = MouseState.Hover : Invalidate()
- End Sub
- End Class
- Class KingwoodCheckBox
- Inherits Control
- Event CheckedChanged(sender As Object)
- Private _Checked As Boolean
- Public Property Checked As Boolean
- Get
- Return _Checked
- End Get
- Set(value As Boolean)
- _Checked = value
- Invalidate()
- End Set
- End Property
- Protected Overrides Sub OnResize(e As EventArgs)
- MyBase.OnResize(e)
- Size = New Point(Width, 17)
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
- MyBase.OnPaint(e)
- G.DrawString(Text, UIFont, New SolidBrush(Color.FromArgb(110, 110, 110)), New Point(22, -1))
- G.DrawRectangle(New Pen(Color.FromArgb(170, 170, 170)), New Rectangle(0, 0, 15, 15))
- If Checked Then
- G.FillRectangle(New SolidBrush(UI), New Rectangle(3, 3, 10, 10))
- RoundRect(G, 2, 2, 11, 11, 3, UI)
- End If
- End Sub
- Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
- MyBase.OnMouseUp(e)
- If Checked Then
- Checked = False
- Else
- Checked = True
- End If
- End Sub
- End Class
- Class KingwoodRadioButton
- Inherits Control
- Event CheckedChanged(sender As Object)
- Private _Checked As Boolean
- Public Property Checked As Boolean
- Get
- Return _Checked
- End Get
- Set(value As Boolean)
- _Checked = value
- Invalidate()
- End Set
- End Property
- Protected Overrides Sub OnResize(e As EventArgs)
- MyBase.OnResize(e)
- Size = New Point(Width, 17)
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
- MyBase.OnPaint(e)
- G.DrawString(Text, UIFont, New SolidBrush(Color.FromArgb(110, 110, 110)), New Point(22, -1))
- G.DrawEllipse(New Pen(Color.FromArgb(170, 170, 170)), New Rectangle(0, 0, 15, 15))
- If Checked Then
- G.FillEllipse(New SolidBrush(UI), New Rectangle(2, 2, 11, 11))
- End If
- End Sub
- Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
- MyBase.OnMouseUp(e)
- If Checked Then
- Checked = False
- Else
- Checked = True
- End If
- End Sub
- End Class
- Class KingwoodGroupBox
- Inherits GroupBox
- Protected Overrides Sub OnCreateControl()
- MyBase.OnCreateControl()
- SetStyle(ControlStyles.UserPaint, True)
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
- MyBase.OnPaint(e)
- G.Clear(Color.FromArgb(227, 227, 227))
- G.DrawRectangle(New Pen(Color.FromArgb(210, 210, 210)), New Rectangle(0, 0, Width - 1, Height - 1))
- G.FillRectangle(New SolidBrush(Color.FromArgb(62, 71, 86)), New Rectangle(0, 0, Width, 30))
- CenterString(G, Text, UIFont, Brushes.White, New Rectangle(0, 0, Width, 30))
- End Sub
- End Class
- Class KingwoodProgressBar
- Inherits Control
- Private _Maximum As Integer
- Public Property Maximum As Integer
- Get
- Return _Maximum
- End Get
- Set(value As Integer)
- _Maximum = value
- Invalidate()
- End Set
- End Property
- Private _Minimum As Integer
- Public Property Minimum As Integer
- Get
- Return _Minimum
- End Get
- Set(value As Integer)
- _Minimum = value
- Invalidate()
- End Set
- End Property
- Private _Value As Integer
- Public Property Value As Integer
- Get
- Return _Value
- End Get
- Set(value As Integer)
- _Value = value
- Invalidate()
- End Set
- End Property
- Sub New()
- Maximum = 100
- Minimum = 0
- Value = 0
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- MyBase.OnPaint(e)
- G.DrawRectangle(New Pen(Color.FromArgb(210, 210, 210)), New Rectangle(0, 0, Width - 1, Height - 1))
- Select Case _Value
- Case Is > 2
- G.FillRectangle(New SolidBrush(UI), New Rectangle(0, 0, CInt(Value / Maximum * Width), Height))
- Case Is > 0
- G.FillRectangle(New SolidBrush(UI), New Rectangle(0, 0, CInt(Value / Maximum * Width), Height))
- End Select
- End Sub
- End Class
- Class KingwoodMessage
- Inherits TextBox
- Protected Overrides Sub OnCreateControl()
- MyBase.OnCreateControl()
- SetStyle(ControlStyles.UserPaint, True)
- Enabled = False
- Multiline = True
- BorderStyle = Windows.Forms.BorderStyle.None
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
- MyBase.OnPaint(e)
- G.Clear(Color.FromArgb(227, 227, 227))
- G.FillRectangle(New SolidBrush(Color.FromArgb(250, 245, 216)), New Rectangle(1, 1, Width - 2, Height - 2))
- RoundRect(G, 0, 0, Width - 1, Height - 1, 3, Color.FromArgb(225, 220, 191))
- G.DrawString(Text, UIFont, New SolidBrush(Color.FromArgb(110, 110, 110)), New Point(12, 8))
- End Sub
- End Class
- Class KingwoodTextBox
- Inherits Control
- Dim WithEvents _tb As New TextBox
- Private State As MouseState
- #Region "Properties"
- Private _allowpassword As Boolean = False
- Public Shadows Property UseSystemPasswordChar() As Boolean
- Get
- Return _allowpassword
- End Get
- Set(ByVal value As Boolean)
- _tb.UseSystemPasswordChar = UseSystemPasswordChar
- _allowpassword = value
- Invalidate()
- End Set
- End Property
- Private _maxChars As Integer = 32767
- Public Shadows Property MaxLength() As Integer
- Get
- Return _maxChars
- End Get
- Set(ByVal value As Integer)
- _maxChars = value
- _tb.MaxLength = MaxLength
- Invalidate()
- End Set
- End Property
- Private _textAlignment As HorizontalAlignment
- Public Shadows Property TextAlign() As HorizontalAlignment
- Get
- Return _textAlignment
- End Get
- Set(ByVal value As HorizontalAlignment)
- _textAlignment = value
- Invalidate()
- End Set
- End Property
- Private _multiLine As Boolean = False
- Public Shadows Property MultiLine() As Boolean
- Get
- Return _multiLine
- End Get
- Set(ByVal value As Boolean)
- _multiLine = value
- _tb.Multiline = value
- OnResize(EventArgs.Empty)
- Invalidate()
- End Set
- End Property
- Private _readOnly As Boolean = False
- Public Shadows Property [ReadOnly]() As Boolean
- Get
- Return _readOnly
- End Get
- Set(ByVal value As Boolean)
- _readOnly = value
- If _tb IsNot Nothing Then
- _tb.ReadOnly = value
- End If
- End Set
- End Property
- Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
- MyBase.OnTextChanged(e)
- Invalidate()
- End Sub
- Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
- MyBase.OnGotFocus(e)
- _tb.Focus()
- End Sub
- Private Sub TextChangeTb() Handles _tb.TextChanged
- Text = _tb.Text
- End Sub
- Private Sub TextChng() Handles MyBase.TextChanged
- _tb.Text = Text
- End Sub
- #End Region
- Public Sub NewTextBox()
- With _tb
- .Text = String.Empty
- .BackColor = Color.FromArgb(227, 227, 227)
- .ForeColor = Color.FromArgb(130, 130, 130)
- .TextAlign = HorizontalAlignment.Left
- .BorderStyle = BorderStyle.None
- .Font = UIFont
- .Size = New Size(Width - 3, Height - 3)
- .UseSystemPasswordChar = UseSystemPasswordChar
- End With
- End Sub
- Sub New()
- MyBase.New()
- NewTextBox()
- Controls.Add(_tb)
- SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
- DoubleBuffered = True
- TextAlign = HorizontalAlignment.Left
- ForeColor = Color.FromArgb(170, 170, 170)
- Font = UIFont
- Size = New Size(130, 29)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
- MyBase.OnPaint(e)
- G.Clear(Color.FromArgb(227, 227, 227))
- If State = MouseState.Down Then
- RoundRect(G, 0, 0, Width - 1, Height - 1, 3, Color.FromArgb(62, 71, 86))
- Else
- RoundRect(G, 0, 0, Width - 1, Height - 1, 3, Color.FromArgb(210, 210, 210))
- End If
- _tb.TextAlign = TextAlign
- _tb.UseSystemPasswordChar = UseSystemPasswordChar
- End Sub
- Protected Overrides Sub OnResize(e As EventArgs)
- MyBase.OnResize(e)
- If Not MultiLine Then
- Dim tbheight As Integer = _tb.Height
- _tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 0), Integer))
- _tb.Size = New Size(Width - 20, tbheight)
- Else
- _tb.Location = New Point(10, 10)
- _tb.Size = New Size(Width - 20, Height - 20)
- End If
- End Sub
- Protected Overrides Sub OnEnter(e As EventArgs)
- MyBase.OnEnter(e)
- State = MouseState.Down : Invalidate()
- End Sub
- Protected Overrides Sub OnLeave(e As EventArgs)
- MyBase.OnLeave(e)
- State = MouseState.None : Invalidate()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement