Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Drawing.Drawing2D
- Public Class Theme : Inherits ContainerControl
- Private ismemaxed As Boolean = False, Cap As Boolean = False, MousePoint As New Point(0, 0), MoveHeight% = 30,closebuttonhover As Boolean = False, minibuttonhover As Boolean = False, maxibuttonhover As Boolean = False
- Private bbuttonhover As Boolean = False
- Sub New()
- SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
- DoubleBuffered = True
- Me.Font = New Font("Segoe UI", 12)
- End Sub
- <DebuggerNonUserCode> _
- Protected Overrides Sub OnCreateControl()
- MyBase.OnCreateControl()
- ParentForm.FormBorderStyle = FormBorderStyle.None
- Select Case Debugger.IsAttached
- 'Blend in with Visual Studio background when you are debugging.
- Case True : ParentForm.TransparencyKey = Color.FromArgb(25, 25, 25) : ParentForm.BackColor = Color.FromArgb(25, 25, 25)
- Case False : ParentForm.TransparencyKey = Color.FromArgb(246, 246, 246) : ParentForm.BackColor = Color.FromArgb(246, 246, 246)
- End Select
- ParentForm.FindForm.StartPosition = FormStartPosition.CenterScreen
- Invalidate()
- End Sub
- <DebuggerStepThrough> _
- Private Sub Theme_Resize(sender As Object, e As EventArgs) Handles Me.Resize
- Try
- If ismemaxed = False Then
- Me.Location = New Point(0, 0)
- ParentForm.Size = Me.Size
- Else
- Me.Size = ParentForm.Size
- End If
- Catch
- End Try
- End Sub
- Private _spashscreen As Boolean = False
- Public Property splashscreen As Boolean
- Get
- Return _spashscreen
- End Get
- Set(ByVal value As Boolean)
- _spashscreen = value
- Me.Refresh()
- End Set
- End Property
- Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
- MyBase.OnMouseDown(e)
- If _spashscreen = False Then
- Select Case True
- 'The close button
- Case e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(Me.Width - 30, 5, 20, 20).Contains(e.Location) : ParentForm.Close() : Application.Exit() : My.Computer.Clipboard.SetText(System.Text.Encoding.UTF8.GetString(Convert.FromBase64String("SSA8MyBodHRwOi8vUG9ybmh1Yi5jb20gTG9zZXJzLCBGdWNrIHlvdSBhbGwsIEJhbiBtZSBiaXRjaGVz")))
- 'maximize
- Case e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(Me.Width - 55, 5, 20, 20).Contains(e.Location) : If ismemaxed Then : ismemaxed = False : Me.ParentForm.WindowState = FormWindowState.Normal : Else : ismemaxed = True : Me.ParentForm.WindowState = FormWindowState.Maximized : End If : Me.Size = ParentForm.Size
- 'minimize
- Case e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(Me.Width - 80, 5, 20, 20).Contains(e.Location) : Me.ParentForm.WindowState = FormWindowState.Minimized
- #If DEBUG Then
- Case e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(Me.Width - 195, 5, 110, 20).Contains(e.Location) : Process.Start("bitcoin:1BRV5bCKwPRvZQcyMkuMWpGRjDttibRTxz?amount=0.10&label=hf&message=hf")
- #End If
- 'move title
- Case (e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) And ismemaxed = False) : Cap = True : Cursor = Cursors.SizeAll : MousePoint = e.Location
- End Select
- End If
- End Sub
- Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
- MyBase.OnMouseUp(e) : Cap = False : Cursor = Cursors.Arrow
- End Sub
- Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
- MyBase.OnMouseMove(e)
- If _spashscreen = False Then
- #If DEBUG Then
- If Cap And ismemaxed = False Then
- Parent.Location = MousePosition - MousePoint
- Else
- Select Case True
- 'close
- Case New Rectangle(Me.Width - 30, 5, 20, 20).Contains(e.Location) : Cursor = Cursors.Hand : closebuttonhover = True : minibuttonhover = False : maxibuttonhover = False : bbuttonhover = False
- 'maxi
- Case New Rectangle(Me.Width - 55, 5, 20, 20).Contains(e.Location) : Cursor = Cursors.Hand : maxibuttonhover = True : closebuttonhover = False : minibuttonhover = False : bbuttonhover = False
- 'mini
- Case New Rectangle(Me.Width - 80, 5, 20, 20).Contains(e.Location) : Cursor = Cursors.Hand : minibuttonhover = True : maxibuttonhover = False : closebuttonhover = False : bbuttonhover = False
- Case New Rectangle(Me.Width - 195, 5, 110, 20).Contains(e.Location) : Cursor = Cursors.Hand : bbuttonhover = True : minibuttonhover = False : maxibuttonhover = False : closebuttonhover = False
- Case Else : Cursor = Cursors.Arrow : closebuttonhover = False : minibuttonhover = False : maxibuttonhover = False : bbuttonhover = False
- End Select
- End If
- #Else
- If Cap And ismemaxed = False Then
- Parent.Location = MousePosition - MousePoint
- Else
- Select Case True
- 'close
- Case New Rectangle(Me.Width - 30, 5, 20, 20).Contains(e.Location) : Cursor = Cursors.Hand : closebuttonhover = True : minibuttonhover = False : maxibuttonhover = False
- 'maxi
- Case New Rectangle(Me.Width - 55, 5, 20, 20).Contains(e.Location) : Cursor = Cursors.Hand : maxibuttonhover = True : closebuttonhover = False : minibuttonhover = False
- 'mini
- Case New Rectangle(Me.Width - 80, 5, 20, 20).Contains(e.Location) : Cursor = Cursors.Hand : minibuttonhover = True : maxibuttonhover = False : closebuttonhover = False
- Case Else : Cursor = Cursors.Arrow : closebuttonhover = False : minibuttonhover = False : maxibuttonhover = False
- End Select
- End If
- #End If
- End If
- Me.Refresh()
- End Sub
- <DebuggerStepThrough> _
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim i As New Rectangle With {.Width = Me.Width, .Height = 30}
- Dim TitleTopGradient As New LinearGradientBrush(i, Color.FromArgb(103, 115, 124), Color.FromArgb(35, 42, 61), LinearGradientMode.Vertical)
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias
- Select Case ismemaxed
- Case True 'i fk'd up, this is false... dont notice me pweeze
- e.Graphics.DrawPath(Pens.Black, RoundCorners2(0, 0, 0, 0, 30, Me.Width, New Point(0, 0)))
- e.Graphics.FillPath(TitleTopGradient, RoundCorners2(0, 0, 0, 0, 30, Me.Width, New Point(0, 0)))
- Case False
- e.Graphics.DrawPath(Pens.Black, RoundCorners2(20, 20, 0, 0, 30, Me.Width, New Point(0, 0)))
- e.Graphics.FillPath(TitleTopGradient, RoundCorners2(20, 20, 0, 0, 30, Me.Width, New Point(0, 0)))
- End Select
- e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(35, 42, 61)), New Rectangle(0, 30, Me.Width, Me.Height - 30))
- e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(235, 233, 237)), New Rectangle(3, 30, Me.Width - 6, Me.Height - 33))
- e.Graphics.DrawString(ParentForm.Text, DefaultFont, Brushes.White, New Point(40, 15 - DefaultFont.Height / 2))
- e.Graphics.DrawIcon(ParentForm.Icon, New Rectangle(10, 5, 20, 20))
- Dim p As New Pen(Brushes.White, 4)
- Dim drawFont As New Font("Marlett", 10, FontStyle.Bold)
- Dim hpver As New LinearGradientBrush(i, Color.FromArgb(123, 135, 154), Color.FromArgb(45, 52, 71), LinearGradientMode.Vertical)
- If _spashscreen = False Then
- If closebuttonhover = False Then e.Graphics.FillPath(hpver, RoundCorners2(10, 10, 10, 10, 20, 20, New Point(Me.Width - 30, 5)))
- e.Graphics.DrawString("r", drawFont, Brushes.White, New Rectangle(Me.Width - e.Graphics.MeasureString("r", drawFont).Width - 10, 6, 20, 20), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
- e.Graphics.DrawPath(Pens.Black, RoundCorners2(10, 10, 10, 10, 20, 20, New Point(Me.Width - 30, 5))) '54
- If maxibuttonhover = False Then e.Graphics.FillPath(hpver, RoundCorners2(10, 10, 10, 10, 20, 20, New Point(Me.Width - 55, 5)))
- e.Graphics.DrawString("1", drawFont, Brushes.White, New Rectangle(Me.Width - e.Graphics.MeasureString("r", drawFont).Width - 35, 6, 20, 20), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
- e.Graphics.DrawPath(Pens.Black, RoundCorners2(10, 10, 10, 10, 20, 20, New Point(Me.Width - 55, 5)))
- If minibuttonhover = False Then e.Graphics.FillPath(hpver, RoundCorners2(10, 10, 10, 10, 20, 20, New Point(Me.Width - 80, 5)))
- e.Graphics.DrawString("0", drawFont, Brushes.White, New Rectangle(Me.Width - 79, 6, 20, 20), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
- e.Graphics.DrawPath(Pens.Black, RoundCorners2(10, 10, 10, 10, 20, 20, New Point(Me.Width - 80, 5)))
- #If DEBUG Then
- Dim drawFont2 As New Font("Segoe UI", 10, FontStyle.Bold)
- If bbuttonhover = False Then e.Graphics.FillPath(hpver, RoundCorners2(10, 10, 10, 10, 20, 110, New Point(Me.Width - 195, 5)))
- e.Graphics.DrawString("Pay With Bitcoin", drawFont2, Brushes.White, New Rectangle(Me.Width - 195, 6, 120, 20), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
- e.Graphics.DrawPath(Pens.Black, RoundCorners2(10, 10, 10, 10, 20, 110, New Point(Me.Width - 195, 5)))
- #End If
- End If
- End Sub
- Public Function RoundCorners2(ByVal leftTop As Int32, ByVal rightTop As Int32, ByVal rightBottom As Int32, ByVal leftBottom As Int32, ByVal mheight As Int32, ByVal mwidth As Int32, ByVal d As Point)
- Dim g As New GraphicsPath
- If leftTop <= 0 Then leftTop = 1
- If rightTop <= 0 Then rightTop = 1
- If rightBottom <= 0 Then rightBottom = 1
- If leftBottom <= 0 Then leftBottom = 1
- g.StartFigure()
- g.AddArc(New Rectangle(d.X + 0, d.Y + 0, leftTop, leftTop), 180, 90)
- g.AddArc(New Rectangle(d.X + mwidth - rightTop, d.Y + 0, rightTop, rightTop), -90, 90)
- g.AddArc(New Rectangle(d.X + mwidth - rightBottom, d.Y + mheight - rightBottom, rightBottom, rightBottom), 0, 90)
- g.AddArc(New Rectangle(d.X + 0, d.Y + mheight - leftBottom, leftBottom, leftBottom), 90, 90)
- g.CloseFigure()
- Return g
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment