DinoDz

Bitdefender theme

May 15th, 2016
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 10.73 KB | None | 0 0
  1.      Imports System.Drawing.Drawing2D
  2. Public Class Bitdefender_Form
  3.     Inherits ContainerControl
  4.     Private drag As Boolean = False
  5.     Private savePoint As New Point(0, 0)
  6.     Sub New()
  7.         DoubleBuffered = True
  8.         Dock = DockStyle.Fill
  9.         Font = New Font("Segoe UI", 12)
  10.     End Sub
  11.  
  12.     Protected Overrides Sub OnCreateControl()
  13.         MyBase.OnCreateControl()
  14.         FindForm.FormBorderStyle = FormBorderStyle.None
  15.         FindForm.BackColor = ColorTranslator.FromHtml("#212426")
  16.     End Sub
  17.  
  18.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  19.         MyBase.OnPaint(e)
  20.         Dim g As Graphics = e.Graphics
  21.         g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  22.  
  23.         g.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#212426")), -1, -1, Width + 1, Height + 1)
  24.         g.DrawLine(New Pen(ColorTranslator.FromHtml("#40474d")), 1, 51, Width, 51)
  25.  
  26.         g.DrawString("0", New Font("Marlett", 12), New SolidBrush(ColorTranslator.FromHtml("#808d98")), Width - 60, 12)
  27.         g.DrawString("0", New Font("Marlett", 12), New SolidBrush(ColorTranslator.FromHtml("#808d98")), Width - 65, 12)
  28.         g.DrawString("r", New Font("Marlett", 12), New SolidBrush(ColorTranslator.FromHtml("#808d98")), Width - 29, 12)
  29.  
  30.  
  31.         g.DrawString(Text, Font, Brushes.White, (Width / 2) - (g.MeasureString(Text, Font).Width / 2), 25 - (g.MeasureString(Text, Font).Height / 2))
  32.     End Sub
  33.  
  34.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  35.         MyBase.OnMouseDown(e)
  36.         If New Rectangle(731, 12, 21.8, 18).Contains(e.X, e.Y) Then
  37.             Application.Exit()
  38.         End If
  39.         If New Rectangle(695, 12, 21.8, 18).Contains(e.X, e.Y) Then
  40.             FindForm.WindowState = FormWindowState.Minimized
  41.         End If
  42.  
  43.         If New Rectangle(0, 0, Width, 51).Contains(e.X, e.Y) Then
  44.             drag = True
  45.             savePoint = New Point(e.X, e.Y)
  46.         Else
  47.             drag = False
  48.         End If
  49.     End Sub
  50.  
  51.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  52.         MyBase.OnMouseUp(e)
  53.         drag = False
  54.     End Sub
  55.  
  56.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  57.         MyBase.OnMouseMove(e)
  58.         Dim g As Graphics = CreateGraphics()
  59.         If drag Then
  60.             Dim screenPoint As Point = PointToScreen(e.Location)
  61.             FindForm().Location = New Point(screenPoint.X - Me.savePoint.X, screenPoint.Y - Me.savePoint.Y)
  62.         End If
  63.         Invalidate()
  64.     End Sub
  65. End Class
  66.  
  67. Public Class Bitdefender_Button
  68.     Inherits Control
  69.     Public _Image As Image
  70.  
  71.     Public Property Image As Image
  72.         Get
  73.             Return _Image
  74.         End Get
  75.         Set(value As Image)
  76.             _Image = value
  77.             Invalidate()
  78.         End Set
  79.     End Property
  80.     Sub New()
  81.         Size = New Size(172, 172)
  82.         DoubleBuffered = True
  83.     End Sub
  84.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  85.         MyBase.OnPaint(e)
  86.         Dim g As Graphics = e.Graphics
  87.         g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  88.         g.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#555e66")), -1, -1, Width + 1, Height + 1)
  89.         If _Image IsNot Nothing Then
  90.             g.DrawImage(_Image, New Rectangle(Width / 2 - 25, Height / 2 - 25, 50, 50))
  91.             g.DrawString(Text, Font, Brushes.White, (Width / 2) - (g.MeasureString(Text, Font).Width / 2) + 1, (Height / 2) + 35)
  92.         Else
  93.             g.DrawString(Text, Font, Brushes.White, (Width / 2) - (g.MeasureString(Text, Font).Width / 2) + 1, (Height / 2) - (g.MeasureString(Text, Font).Height / 2))
  94.         End If
  95.     End Sub
  96. End Class
  97.  
  98. Public Class Bitdefender_Button_Small
  99.     Inherits Control
  100.     Public _Image As Image
  101.     Public Property Image As Image
  102.         Get
  103.             Return _Image
  104.         End Get
  105.         Set(value As Image)
  106.             _Image = value
  107.             Invalidate()
  108.         End Set
  109.     End Property
  110.     Sub New()
  111.         Size = New Size(84, 84)
  112.         DoubleBuffered = True
  113.     End Sub
  114.  
  115.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  116.         MyBase.OnPaint(e)
  117.         Dim g As Graphics = e.Graphics
  118.         g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  119.  
  120.         g.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#40474d  ")), -1, -1, Width + 1, Height + 1)
  121.  
  122.         If _Image IsNot Nothing Then
  123.             g.DrawImage(_Image, New Rectangle(Width / 2 - 15, Height / 2 - 15, 30, 30))
  124.             g.DrawString(Text, Font, Brushes.White, (Width / 2) - (g.MeasureString(Text, Font).Width / 2) + 1, (Height / 2) + 20)
  125.         Else
  126.             g.DrawString(Text, Font, Brushes.White, (Width / 2) - (g.MeasureString(Text, Font).Width / 2) + 1, (Height / 2) - (g.MeasureString(Text, Font).Height / 2))
  127.         End If
  128.     End Sub
  129.  
  130. End Class
  131.  
  132. Public Class Bitdefender_Flip_Switch
  133.     Inherits Control
  134.  
  135.     Public _checked As Boolean = False
  136.  
  137.     Public Property Checked As Boolean
  138.         Get
  139.             Return _checked
  140.         End Get
  141.         Set(value As Boolean)
  142.             _checked = value
  143.             Invalidate()
  144.         End Set
  145.     End Property
  146.  
  147.     Sub New()
  148.         DoubleBuffered = True
  149.         Size = New Size(60, 30)
  150.     End Sub
  151.  
  152.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  153.         MyBase.OnPaint(e)
  154.         Dim g As Graphics = e.Graphics
  155.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  156.  
  157.         g.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#3f464c")), -1, -1, Width + 1, Height + 1)
  158.  
  159.         If _checked Then
  160.             g.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#202325")), 2, 2, 27, 26)
  161.             g.DrawString("✓", New Font("Segoe UI Light", 12), New SolidBrush(ColorTranslator.FromHtml("#808d98")), 4.5, 4)
  162.         Else
  163.             g.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#202325")), 31, 2, 27, 26)
  164.             g.DrawString("r", New Font("Marlett", 12), New SolidBrush(ColorTranslator.FromHtml("#808d98")), 34.5, 6.7)
  165.         End If
  166.     End Sub
  167.  
  168.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  169.         MyBase.OnMouseDown(e)
  170.         If New Rectangle(2, 2, 27, 26).Contains(e.X, e.Y) Then
  171.             If Checked = True Then
  172.                 Checked = False
  173.             Else
  174.                 Checked = True
  175.             End If
  176.         ElseIf New Rectangle(31, 2, 27, 26).Contains(e.X, e.Y) Then
  177.             If Checked = True Then
  178.                 Checked = False
  179.             Else
  180.                 Checked = True
  181.             End If
  182.         End If
  183.     End Sub
  184.  
  185. End Class
  186.  
  187. Public Class Bitdefender_ComboBox
  188.     Inherits ComboBox
  189.     Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  190.         e.DrawBackground()
  191.         If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  192.             e.Graphics.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#4b5359")), e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
  193.         Else
  194.             e.Graphics.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#4b5359")), e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
  195.         End If
  196.         e.Graphics.DrawString(GetItemText(Items(e.Index)), e.Font, Brushes.White, New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
  197.  
  198.     End Sub
  199.  
  200.     Sub New()
  201.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  202.                ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  203.                ControlStyles.SupportsTransparentBackColor, True)
  204.         DoubleBuffered = True
  205.         DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
  206.         DropDownStyle = ComboBoxStyle.DropDownList
  207.         Width = 120
  208.         Font = New Font("Segoe UI", 12)
  209.     End Sub
  210.  
  211.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  212.         MyBase.OnPaint(e)
  213.         Dim g As Graphics = e.Graphics
  214.         Dim Square As New Rectangle(Width - 25, 0, Width, Height)
  215.         g.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#4b5359")), New Rectangle(0, 0, Width, Height))
  216.         g.DrawString(Text, Font, Brushes.White, New Rectangle(3, 0, Width - 20, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  217.         g.DrawString("6", New Font("Marlett", 10), Brushes.White, Width - 20, 10)
  218.     End Sub
  219.  
  220. End Class
  221.  
  222. Public Class Bitdefender_Checkmark
  223.     Inherits Control
  224.  
  225.     Sub New()
  226.         Size = New Size(120, 120)
  227.     End Sub
  228.  
  229.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  230.         MyBase.OnPaint(e)
  231.         Dim g As Graphics = e.Graphics
  232.         g.SmoothingMode = SmoothingMode.HighQuality
  233.         g.Clear(ColorTranslator.FromHtml("#212426"))
  234.         g.DrawEllipse(New Pen(ColorTranslator.FromHtml("#7eba18"), 2), 1, 1, 117, 117)
  235.         g.DrawString("✓", New Font("Segoe UI Bold", 52), New SolidBrush(ColorTranslator.FromHtml("#7eba18")), (Width / 2) - (g.MeasureString("b", New Font("Marlett", 52)).Width / 2), (Height / 2) - (g.MeasureString("b", New Font("Marlett", 52)).Height / 2))
  236.     End Sub
  237. End Class
  238.  
  239. Public Class Bitdefender_xMark
  240.     Inherits Control
  241.  
  242.     Sub New()
  243.         Size = New Size(120, 120)
  244.     End Sub
  245.  
  246.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  247.         MyBase.OnPaint(e)
  248.         Dim g As Graphics = e.Graphics
  249.         g.SmoothingMode = SmoothingMode.HighQuality
  250.         g.Clear(ColorTranslator.FromHtml("#212426"))
  251.         g.DrawEllipse(New Pen(ColorTranslator.FromHtml("#e85353"), 2), 1, 1, 117, 117)
  252.         g.DrawString("✕", New Font("Segoe UI Bold", 52), New SolidBrush(ColorTranslator.FromHtml("#e85353")), (Width / 2) - (g.MeasureString("b", New Font("Marlett", 52)).Width / 2), (Height / 2) - (g.MeasureString("b", New Font("Marlett", 52)).Height / 2))
  253.     End Sub
  254. End Class
  255.  
  256. Public Class Bitdefender_Label
  257.     Inherits Label
  258.     Sub New()
  259.         BackColor = ColorTranslator.FromHtml("#212426")
  260.         ForeColor = ColorTranslator.FromHtml("#8f9da6")
  261.         Font = New Font("Segoe UI", 11)
  262.     End Sub
  263. End Class
  264.  
  265. Public Class Bitdefender_Link_Label
  266.     Inherits Label
  267.     Public _url As String
  268.     Public Property URL As String
  269.         Get
  270.             Return _url
  271.         End Get
  272.         Set(value As String)
  273.             _url = value
  274.         End Set
  275.     End Property
  276.  
  277.     Sub New()
  278.         Cursor = Cursors.Hand
  279.         BackColor = ColorTranslator.FromHtml("#212426")
  280.         ForeColor = ColorTranslator.FromHtml("#00a1ff")
  281.         Font = New Font("Segoe UI Semibold", 11)
  282.     End Sub
  283.  
  284.     Protected Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs)
  285.         MyBase.OnMouseDown(e)
  286.         If Not _url Is Nothing Then
  287.             Process.Start(_url)
  288.         End If
  289.     End Sub
  290. End Class
Add Comment
Please, Sign In to add comment