Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Drawing.Drawing2D
- '|===========================================================|
- '|===| StR Theme
- '| Creator: LordPankake
- '| HF Account: http://www.hackforums.net/member.php?action=profile&uid=1828119
- '| Created: 8/1/2014, Last edited: 8/5/2014
- '|===========================================================|
- #Region "Base Classes"
- Public Class ThemedControl : Inherits Control
- Public D As New DrawUtils
- Public State As MouseState = MouseState.None
- Public Pal As Palette
- Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
- End Sub
- Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
- MyBase.OnMouseEnter(e)
- State = MouseState.Over
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
- MyBase.OnMouseDown(e)
- State = MouseState.Down
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
- MyBase.OnMouseLeave(e)
- State = MouseState.None
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
- MyBase.OnMouseUp(e)
- State = MouseState.Over
- Invalidate()
- End Sub
- Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
- MyBase.OnTextChanged(e)
- Invalidate()
- End Sub
- Sub New()
- MyBase.New()
- MinimumSize = New Size(20, 20)
- ForeColor = Color.FromArgb(146, 149, 152)
- Font = New Font("Segoe UI", 10.0F)
- DoubleBuffered = True
- BackColor = Color.FromArgb(34, 34, 34)
- Pal = New Palette
- Pal.ColHighest = Color.FromArgb(70, 70, 70)
- Pal.ColHigh = Color.FromArgb(46, 46, 46)
- Pal.ColMed = Color.FromArgb(33, 33, 33)
- Pal.ColDim = Color.FromArgb(22, 22, 22)
- Pal.ColDark = Color.FromArgb(15, 15, 15)
- End Sub
- End Class
- Public Class ThemedContainer : Inherits ContainerControl
- Public D As New DrawUtils
- Protected Drag As Boolean = True
- Public State As MouseState = MouseState.None
- Protected TopCap As Boolean = False
- Protected SizeCap As Boolean = False
- Public Pal As Palette
- Protected MouseP As Point = New Point(0, 0)
- Protected TopGrip As Integer
- Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
- End Sub
- Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
- MyBase.OnMouseEnter(e)
- State = MouseState.Over
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
- MyBase.OnMouseDown(e)
- State = MouseState.Down
- If e.Button = Windows.Forms.MouseButtons.Left And Drag Then
- If New Rectangle(0, 0, Width, TopGrip).Contains(e.Location) Then
- TopCap = True : MouseP = e.Location
- ElseIf New Rectangle(Width - 15, Height - 15, 15, 15).Contains(e.Location) Then
- SizeCap = True : MouseP = e.Location
- End If
- End If
- End Sub
- Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
- MyBase.OnMouseLeave(e)
- State = MouseState.None
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
- MyBase.OnMouseUp(e)
- State = MouseState.Over
- If Drag Then
- TopCap = False
- SizeCap = False
- End If
- End Sub
- Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
- MyBase.OnMouseMove(e)
- If Drag Then
- If TopCap Then
- Parent.Location = MousePosition - MouseP
- End If
- If SizeCap Then
- MouseP = e.Location
- Parent.Size = New Size(MouseP)
- Invalidate()
- End If
- End If
- End Sub
- Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
- MyBase.OnTextChanged(e)
- Invalidate()
- End Sub
- Sub New()
- MyBase.New()
- MinimumSize = New Size(20, 20)
- ForeColor = Color.FromArgb(146, 149, 152)
- Font = New Font("Trebuchet MS", 10.0F)
- DoubleBuffered = True
- BackColor = Color.FromArgb(34, 34, 34)
- Pal = New Palette
- Pal.ColHighest = Color.FromArgb(70, 70, 70)
- Pal.ColHigh = Color.FromArgb(46, 46, 46)
- Pal.ColMed = Color.FromArgb(33, 33, 33)
- Pal.ColDim = Color.FromArgb(16, 16, 16)
- Pal.ColDark = Color.FromArgb(12, 12, 12)
- End Sub
- End Class
- #End Region
- #Region "Theme Objects"
- Public Class StRForm : Inherits ThemedContainer
- Public Property SolidTop As Boolean
- Sub New()
- MyBase.New()
- Dock = DockStyle.Fill
- TopGrip = 26
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim G As Graphics = e.Graphics
- MyBase.OnPaint(e)
- Try
- If Not Me.ParentForm.FormBorderStyle = FormBorderStyle.None Then
- Me.ParentForm.FormBorderStyle = FormBorderStyle.None
- End If
- Catch ex As Exception : End Try
- G.Clear(Me.ParentForm.TransparencyKey)
- Dim TopGlowGradient As New LinearGradientBrush(New Point(0, 0), New Point(0, (TopGrip / 2) + 4), Color.FromArgb(140, Pal.ColHighest.R + 44, Pal.ColHighest.R + 44, Pal.ColHighest.R + 44), Color.Transparent)
- Dim DiagonalBrush As New HatchBrush(HatchStyle.DarkUpwardDiagonal, Color.FromArgb(Pal.ColMed.R, Pal.ColMed.R, Pal.ColMed.R), Color.Transparent)
- Dim LeftGripPath As New GraphicsPath
- Dim RightGripPath As New GraphicsPath
- LeftGripPath.AddRectangle(New Rectangle(0, 0, G.MeasureString(Text, Font).Width + 2, TopGrip + 1))
- LeftGripPath.AddRectangle(New Rectangle(0, TopGrip + 1, 8, Height))
- '|========= Outer Base =========|
- G.FillRectangle(New SolidBrush(Color.FromArgb(Pal.ColMed.R - 12, Pal.ColMed.R - 12, Pal.ColMed.R - 12)), New Rectangle(0, 0, Width - 1, Height - 1))
- G.FillRectangle(DiagonalBrush, New Rectangle(0, 0, Width - 1, Height - 1))
- G.FillPath(New SolidBrush(Pal.ColDim), LeftGripPath)
- ' G.DrawPath(Pens.Black, LeftGripPath)
- Dim DrawLeft As Boolean
- Dim LeftMostX As Integer
- Dim DrawSideLines As Boolean = True
- For Each cont As Control In Controls
- If cont.Location.Y < TopGrip Then
- DrawLeft = True
- LeftMostX = cont.Location.X
- End If
- Next
- RightGripPath.AddRectangle(New Rectangle(LeftMostX - 4, 0, Width, TopGrip + 1))
- RightGripPath.AddRectangle(New Rectangle(Width - 9, TopGrip + 1, 8, Height))
- If DrawLeft Then
- G.FillPath(New SolidBrush(Pal.ColDim), RightGripPath)
- End If
- If Math.Abs((LeftMostX - 4) - (G.MeasureString(Text, Font).Width + 2)) < 100 Or SolidTop Then
- DrawSideLines = False
- G.FillRectangle(New SolidBrush(Pal.ColDim), New Rectangle(0, 0, Width, TopGrip + 1))
- End If
- D.FillGradientBeam(G, Color.FromArgb(140, Pal.ColHighest.R - 10, Pal.ColHighest.R - 10, Pal.ColHighest.R - 10), New Rectangle(1, 1, Width - 1, Height - 1), GradientAlignment.Vertical)
- G.DrawRectangle(New Pen(Pal.ColHigh), New Rectangle(1, 1, Width - 3, Height - 3))
- G.DrawLine(New Pen(New SolidBrush(Pal.ColDim)), New Point(2, Height - 2), New Point(8, Height - 2))
- G.DrawLine(Pens.Black, New Point(8, Height - 8), New Point(8, Height - 1))
- G.DrawLine(Pens.Black, New Point(Width - 9, Height - 8), New Point(Width - 9, Height - 1))
- If DrawSideLines Then
- G.DrawLine(Pens.Black, New Point(G.MeasureString(Text, Font).Width + 2, 0), New Point(G.MeasureString(Text, Font).Width + 2, TopGrip + 1))
- G.DrawLine(Pens.Black, New Point(LeftMostX - 4, 0), New Point(LeftMostX - 4, TopGrip + 1))
- End If
- G.FillRectangle(TopGlowGradient, New Rectangle(0, 0, Width - 1, TopGrip / 2 + 1))
- '|========= Inner Base =========|
- Dim InnerRect As New Rectangle(8, TopGrip + 1, Width - 17, Height - TopGrip * 2 + 17)
- G.FillRectangle(New SolidBrush(Pal.ColDim), InnerRect)
- G.DrawRectangle(Pens.Black, InnerRect)
- '|========= Finalizations =========|
- G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
- D.DrawTextWithShadow(G, New Rectangle(6, 0, Width, TopGrip + 1), Text, Font, HorizontalAlignment.Left, Color.FromArgb(199, 199, 199), Color.Black)
- End Sub
- End Class
- Public Class StRTopButton : Inherits ThemedControl
- Sub New()
- MyBase.New()
- Font = New Font("Trebuchet MS", 10.0F)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim G As Graphics = e.Graphics
- MyBase.OnPaint(e)
- G.Clear(Me.Parent.BackColor)
- G.SmoothingMode = SmoothingMode.HighQuality
- Dim ColBase As Integer
- Dim ColDiff As Integer
- Dim Rect1 As GraphicsPath = D.RoundRect(New Rectangle(1, 1, Width - 2, (Height / 3) * 2), 2)
- Dim Rect2 As GraphicsPath = D.RoundRect(New Rectangle(1, (Height / 3) + 1, Width - 2, Height - 1), 2)
- Dim Border1 As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), 2)
- Dim Border2 As GraphicsPath = D.RoundRect(New Rectangle(0, 1, Width - 1, Height - 2), 2)
- Select Case State
- Case MouseState.None
- ColBase = 26
- ColDiff = 7
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase + ColDiff, ColBase + ColDiff, ColBase + ColDiff)), Rect1)
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase - ColDiff, ColBase - ColDiff, ColBase - ColDiff)), Rect2)
- Case MouseState.Over
- ColBase = 34
- ColDiff = 7
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase + ColDiff, ColBase + ColDiff, ColBase + ColDiff)), Rect1)
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase - ColDiff, ColBase - ColDiff, ColBase - ColDiff)), Rect2)
- Case MouseState.Down
- ColBase = 20
- ColDiff = 3
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase + ColDiff, ColBase + ColDiff, ColBase + ColDiff)), Rect1)
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase - ColDiff, ColBase - ColDiff, ColBase - ColDiff)), Rect2)
- End Select
- G.DrawPath(New Pen(New SolidBrush(Pal.ColHighest)), Border2)
- G.DrawPath(Pens.Black, Border1)
- Dim TextRect As New Rectangle(0, 0, Width, Height - 4)
- D.DrawTextWithShadow(G, TextRect, Text, Font, HorizontalAlignment.Center, Color.FromArgb(199, 199, 199), Color.Black)
- End Sub
- End Class
- Public Class StRButton : Inherits ThemedControl
- Sub New()
- MyBase.New()
- Font = New Font("Trebuchet MS", 10.0F)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim G As Graphics = e.Graphics
- MyBase.OnPaint(e)
- G.Clear(Me.Parent.BackColor)
- G.SmoothingMode = SmoothingMode.HighQuality
- Dim ColBase As Integer
- Dim ColDiff As Integer
- Dim Rect1 As GraphicsPath = D.RoundRect(New Rectangle(1, 1, Width - 2, (Height / 3) * 2), 2)
- Dim Rect2 As GraphicsPath = D.RoundRect(New Rectangle(1, (Height / 3) + 1, Width - 2, Height - 1), 2)
- Dim Border1 As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), 2)
- Dim Border2 As GraphicsPath = D.RoundRect(New Rectangle(0, 1, Width - 1, Height - 2), 2)
- Select Case State
- Case MouseState.None
- ColBase = 37
- ColDiff = 6
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase + ColDiff, ColBase + ColDiff, ColBase + ColDiff)), Rect1)
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase - ColDiff, ColBase - ColDiff, ColBase - ColDiff)), Rect2)
- Case MouseState.Over
- ColBase = 53
- ColDiff = 6
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase + ColDiff, ColBase + ColDiff, ColBase + ColDiff)), Rect1)
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase - ColDiff, ColBase - ColDiff, ColBase - ColDiff)), Rect2)
- Case MouseState.Down
- ColBase = 30
- ColDiff = 6
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase + ColDiff, ColBase + ColDiff, ColBase + ColDiff)), Rect1)
- G.FillPath(New SolidBrush(Color.FromArgb(ColBase - ColDiff, ColBase - ColDiff, ColBase - ColDiff)), Rect2)
- End Select
- G.DrawPath(New Pen(New SolidBrush(Pal.ColHighest)), Border2)
- G.DrawPath(Pens.Black, Border1)
- Dim TextRect As New Rectangle(0, 0, Width, Height - 4)
- D.DrawTextWithShadow(G, TextRect, Text, Font, HorizontalAlignment.Center, Color.FromArgb(199, 199, 199), Color.Black)
- End Sub
- End Class
- Public Class StRTextbox : Inherits ThemedControl
- #Region "Textbox Data"
- Private WithEvents TxtBox As New TextBox
- Private TempSize As Size
- Public Property TxtReadOnly As Boolean
- Public Property MaxCharacters As Integer
- Public Property Multiline() As Boolean
- Get
- Return TxtBox.Multiline
- End Get
- Set(ByVal v As Boolean)
- TxtBox.Multiline = v
- Invalidate()
- End Set
- End Property
- Public Property TextAlign As HorizontalAlignment
- Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
- MyBase.OnSizeChanged(e)
- If Not Size.Height = 21 Then
- TempSize = Size
- End If
- If Not IsNothing(TxtBox) Then
- TxtBox.Size = New Size(Width - 8, Height - 8)
- End If
- Invalidate()
- End Sub
- Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
- MyBase.OnFontChanged(e)
- If Not IsNothing(TxtBox) Then
- TxtBox.Font = Font
- End If
- End Sub
- Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
- MyBase.OnGotFocus(e)
- TxtBox.Focus()
- End Sub
- Private Sub TextChngTxtBox() Handles TxtBox.TextChanged
- Text = TxtBox.Text
- End Sub
- Private Sub TextChng() Handles MyBase.TextChanged
- TxtBox.Text = Text
- End Sub
- Private Sub SetupTextbox()
- TxtBox.MaxLength = 30000
- TxtBox.Size = New Size(New Point(50, 21))
- TxtBox.Multiline = True
- TxtBox.BackColor = Pal.ColDim
- TxtBox.ForeColor = Color.FromArgb(199, 199, 199)
- TxtBox.Text = String.Empty
- TxtBox.TextAlign = HorizontalAlignment.Left
- TxtBox.BorderStyle = BorderStyle.None
- TxtBox.Location = New Point(4, 4)
- TxtBox.Font = Font
- TxtBox.Size = New Size(Width - 8, Height - 8)
- End Sub
- #End Region
- Sub New()
- MyBase.New()
- Font = New Font("Trebuchet MS", 8.5F)
- TxtReadOnly = False
- Multiline = False
- TextAlign = HorizontalAlignment.Left
- SetupTextbox()
- Controls.Add(TxtBox)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim G As Graphics = e.Graphics
- MyBase.OnPaint(e)
- G.Clear(Me.Parent.BackColor)
- If Not TxtBox.Multiline Then
- TxtBox.Location = New Point(6, TxtBox.Top)
- If (TxtBox.Width + TxtBox.Left) > Width - 3 And TxtBox.Width > 5 Then
- TxtBox.Width -= 1
- End If
- Size = New Size(New Point(Width, 21))
- Else
- TxtBox.Location = New Point(3, TxtBox.Top)
- Size = TempSize
- End If
- G.FillRectangle(New SolidBrush(Pal.ColDim), New Rectangle(0, 0, Width - 1, Height - 1))
- G.DrawRectangle(New Pen(Pal.ColHigh), New Rectangle(1, 1, Width - 3, Height - 3))
- G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
- End Sub
- End Class
- Public Class StRCheckPanel : Inherits ThemedControl
- Public Property Checked As Boolean
- Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
- MyBase.OnMouseDown(e)
- Checked = Not Checked
- End Sub
- Sub New()
- MyBase.New()
- Font = New Font("Trebuchet MS", 10.0F)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim G As Graphics = e.Graphics
- MyBase.OnPaint(e)
- G.Clear(Me.Parent.BackColor)
- G.SmoothingMode = SmoothingMode.HighQuality
- Height = 21
- Dim CheckRect As GraphicsPath = D.RoundRect(New Rectangle(1, 1, 20, 20), 2)
- Dim BorderBlack As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), 2)
- Dim BorderHighlight As GraphicsPath = D.RoundRect(New Rectangle(0, 1, Width - 1, Height - 2), 2)
- If Checked Then
- Select Case State
- Case MouseState.None, MouseState.Down
- G.FillPath(New SolidBrush(Color.FromArgb(33, 45, 70)), CheckRect)
- Case MouseState.Over
- G.FillPath(New SolidBrush(Color.FromArgb(44, 66, 90)), CheckRect)
- End Select
- Else
- G.FillPath(New SolidBrush(Color.FromArgb(22, 22, 22)), CheckRect)
- End If
- G.DrawPath(New Pen(New SolidBrush(Pal.ColHighest)), BorderHighlight)
- G.DrawLine(Pens.Black, New Point(22, 0), New Point(22, Height - 2))
- G.DrawPath(Pens.Black, BorderBlack)
- Dim TextRect As New Rectangle(25, 0, Width - 25, Height - 2)
- D.DrawTextWithShadow(G, TextRect, Text, Font, HorizontalAlignment.Left, Color.FromArgb(199, 199, 199), Color.Black)
- End Sub
- End Class
- Public Class StRGroupbox : Inherits ThemedContainer
- Sub New()
- MyBase.New()
- Drag = False
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim G As Graphics = e.Graphics
- MyBase.OnPaint(e)
- G.Clear(Me.Parent.BackColor)
- Dim TopGlowGradient As New LinearGradientBrush(New Point(0, 0), New Point(0, 21), Color.FromArgb(Pal.ColHighest.R - 15, Pal.ColHighest.R - 15, Pal.ColHighest.R - 15), Color.Transparent)
- '|========= Base =========|
- G.FillRectangle(New SolidBrush(Pal.ColMed), New Rectangle(0, 0, Width - 1, Height - 1))
- G.DrawRectangle(New Pen(Pal.ColHigh), New Rectangle(1, 1, Width - 3, Height - 3))
- G.FillRectangle(TopGlowGradient, New Rectangle(0, 0, Width - 1, TopGrip / 2))
- '|========= Top =========|
- G.FillRectangle(TopGlowGradient, New Rectangle(0, 0, Width, 21))
- G.FillRectangle(New SolidBrush(Color.FromArgb(100, Pal.ColDark.R, Pal.ColDark.R, Pal.ColDark.R)), New Rectangle(1, 24, Width - 2, Height - 25))
- G.DrawLine(Pens.Black, New Point(0, 25), New Point(Width, 25))
- G.DrawLine(New Pen(New SolidBrush(Pal.ColHigh)), New Point(2, 26), New Point(Width - 2, 26))
- '|========= Finalizations =========|
- G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
- D.DrawTextWithShadow(G, New Rectangle(6, 0, Width, 24), Text, Font, HorizontalAlignment.Left, Color.FromArgb(199, 199, 199), Color.Black)
- End Sub
- End Class
- #End Region
- '|===========================================================|
- #Region "Theme Utility Stuff"
- Public Class Palette
- Public ColHighest As Color
- Public ColHigh As Color
- Public ColMed As Color
- Public ColDim As Color
- Public ColDark As Color
- End Class
- Public Enum MouseState As Byte
- None = 0
- Over = 1
- Down = 2
- Block = 3
- End Enum
- Public Enum GradientAlignment As Byte
- Vertical = 0
- Horizontal = 1
- End Enum
- Public Class DrawUtils
- Public Sub FillGradientBeam(ByVal g As Graphics, ByVal Col As Color, ByVal rect As Rectangle, ByVal align As GradientAlignment)
- Dim LGB1, LGB2 As LinearGradientBrush
- Dim stored As SmoothingMode = g.SmoothingMode
- g.SmoothingMode = SmoothingMode.HighQuality
- Select Case align
- Case GradientAlignment.Vertical
- LGB1 = New LinearGradientBrush(New Point(rect.X - 1, rect.Y), New Point(rect.X + (rect.Width / 2) + 2, rect.Y), Color.Transparent, Col)
- LGB2 = New LinearGradientBrush(New Point(rect.X + (rect.Width / 2), rect.Y), New Point((rect.X + rect.Width) + 1, rect.Y), Col, Color.Transparent)
- g.FillRectangle(LGB1, New Rectangle(rect.X, rect.Y, (rect.Width / 2), rect.Height))
- g.FillRectangle(LGB2, New Rectangle(rect.X + (rect.Width / 2), rect.Y, rect.Width / 2, rect.Height))
- Case GradientAlignment.Horizontal
- LGB1 = New LinearGradientBrush(New Point(rect.X, rect.Y - 1), New Point(rect.X, rect.Y + (rect.Height / 2) + 2), Color.Transparent, Col)
- LGB2 = New LinearGradientBrush(New Point(rect.X, rect.Y + (rect.Height / 2) - 2), New Point(rect.X, rect.Y + rect.Height), Col, Color.Transparent)
- g.FillRectangle(LGB1, New Rectangle(rect.X, rect.Y, rect.Width, (rect.Height / 2) + 1))
- g.FillRectangle(LGB2, New Rectangle(rect.X, rect.Y + (rect.Height / 2) - 2, rect.Width, rect.Height / 2))
- End Select
- g.SmoothingMode = stored
- End Sub
- Public Sub DrawTextWithShadow(ByVal G As Graphics, ByVal ContRect As Rectangle, ByVal Text As String, ByVal TFont As Font, ByVal TAlign As HorizontalAlignment, ByVal TColor As Color, ByVal BColor As Color)
- DrawText(G, New Rectangle(ContRect.X, ContRect.Y + 2, ContRect.Width + 1, ContRect.Height + 2), Text, TFont, TAlign, BColor)
- DrawText(G, ContRect, Text, TFont, TAlign, TColor)
- End Sub
- Public Sub DrawText(ByVal G As Graphics, ByVal ContRect As Rectangle, ByVal Text As String, ByVal TFont As Font, ByVal TAlign As HorizontalAlignment, ByVal TColor As Color)
- If String.IsNullOrEmpty(Text) Then Return
- Dim TextSize As Size = G.MeasureString(Text, TFont).ToSize
- Dim CenteredY As Integer = ContRect.Height \ 2 - TextSize.Height \ 2
- Select Case TAlign
- Case HorizontalAlignment.Left
- G.DrawString(Text, TFont, New SolidBrush(TColor), ContRect.X, CenteredY)
- Case HorizontalAlignment.Right
- G.DrawString(Text, TFont, New SolidBrush(TColor), ContRect.Width - TextSize.Width - 5, CenteredY)
- Case HorizontalAlignment.Center
- G.DrawString(Text, TFont, New SolidBrush(TColor), ContRect.Width \ 2 - TextSize.Width \ 2, CenteredY)
- End Select
- End Sub
- Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
- Dim P As New GraphicsPath
- Dim ArcRectangleWidth As Integer = Curve * 2
- P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
- P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
- P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
- P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
- P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
- Return P
- End Function
- End Class
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment