Advertisement
netrosly

Control Bubble Box

Aug 11th, 2015
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 10.27 KB | None | 0 0
  1. '[by Nettro from HF]
  2. Imports System.Drawing.Drawing2D
  3.  
  4. Public Class Skype_ControlBox
  5.     Inherits Control
  6.     Sub New()
  7.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  8.             ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  9.             ControlStyles.SupportsTransparentBackColor, True)
  10.         'Setting Flickering off
  11.         DoubleBuffered = True
  12.         'backcolor transparent
  13.         BackColor = Color.Transparent
  14.         'This is important finds the "Form/Control" that it needs to be parent of
  15.         Parent = FindForm()
  16.     End Sub
  17.  
  18.     Property Close_Visible As Boolean = True
  19.     Property Close_Color As Color = Color.FromArgb(255, 74, 54)
  20.     Property Minimize_Visible As Boolean = True
  21.     Property Minimize_Color As Color = Color.FromArgb(255, 182, 83)
  22.     Property Maxmize_Visible As Boolean = True
  23.     Property Maxmize_Color As Color = Color.FromArgb(195, 255, 172)
  24.     Property Left_To_Right As Boolean = True
  25.  
  26.     Private Sub Skype_ControlBox_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
  27.         e.Graphics.SmoothingMode = SmoothingMode.HighQuality
  28.         If Left_To_Right = True Then
  29.             Dim i As Integer = 2
  30.             If Close_Visible = True Then
  31.  
  32.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(60, 255, 255, 255)), New Rectangle(i, 2, 12, 14))
  33.                 Dim brush = New LinearGradientBrush(New Rectangle(i, 1, 12, 13), Color.FromArgb(230, 0, 0, 0), Color.FromArgb(60, 0, 0, 0), 90.0!)
  34.                 e.Graphics.FillEllipse(brush, New Rectangle(i - 1, 1, 14, 13))
  35.                 e.Graphics.FillEllipse(New SolidBrush(Close_Color), New Rectangle(i, 2, 12, 12))
  36.                 brush = New LinearGradientBrush(New Rectangle(i + 1, 3, 10, 4), Color.FromArgb(190, 255, 255, 255), Color.FromArgb(30, 255, 255, 255), 90.0!)
  37.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 1, 3, 10, 3))
  38.                 brush = New LinearGradientBrush(New Rectangle(i + 2, 10, 18, 4), Color.FromArgb(0, 255, 255, 255), Color.FromArgb(120, 255, 255, 255), 90.0!)
  39.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 2, 10, 8, 4))
  40.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(10, 23, 23, 23)), New Rectangle(i + 3, 5, 6, 6))
  41.                 i += 20
  42.             End If
  43.             If Maxmize_Visible = True Then
  44.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(60, 255, 255, 255)), New Rectangle(i, 2, 12, 14))
  45.                 Dim brush = New LinearGradientBrush(New Rectangle(i, 1, 12, 13), Color.FromArgb(230, 0, 0, 0), Color.FromArgb(60, 0, 0, 0), 90.0!)
  46.                 e.Graphics.FillEllipse(brush, New Rectangle(i - 1, 1, 14, 13))
  47.                 e.Graphics.FillEllipse(New SolidBrush(Maxmize_Color), New Rectangle(i, 2, 12, 12))
  48.                 brush = New LinearGradientBrush(New Rectangle(i + 1, 3, 10, 4), Color.FromArgb(190, 255, 255, 255), Color.FromArgb(30, 255, 255, 255), 90.0!)
  49.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 1, 3, 10, 3))
  50.                 brush = New LinearGradientBrush(New Rectangle(i + 2, 10, 18, 4), Color.FromArgb(0, 255, 255, 255), Color.FromArgb(120, 255, 255, 255), 90.0!)
  51.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 2, 10, 8, 4))
  52.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(10, 23, 23, 23)), New Rectangle(i + 3, 5, 6, 6))
  53.                 i += 20
  54.             End If
  55.             If Minimize_Visible = True Then
  56.  
  57.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(60, 255, 255, 255)), New Rectangle(i, 2, 12, 14))
  58.                 Dim brush = New LinearGradientBrush(New Rectangle(i, 1, 12, 13), Color.FromArgb(230, 0, 0, 0), Color.FromArgb(60, 0, 0, 0), 90.0!)
  59.                 e.Graphics.FillEllipse(brush, New Rectangle(i - 1, 1, 14, 13))
  60.                 e.Graphics.FillEllipse(New SolidBrush(Minimize_Color), New Rectangle(i, 2, 12, 12))
  61.                 brush = New LinearGradientBrush(New Rectangle(i + 1, 3, 10, 4), Color.FromArgb(190, 255, 255, 255), Color.FromArgb(30, 255, 255, 255), 90.0!)
  62.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 1, 3, 10, 3))
  63.                 brush = New LinearGradientBrush(New Rectangle(i + 2, 10, 18, 4), Color.FromArgb(0, 255, 255, 255), Color.FromArgb(120, 255, 255, 255), 90.0!)
  64.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 2, 10, 8, 4))
  65.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(10, 23, 23, 23)), New Rectangle(i + 3, 5, 6, 6))
  66.                 i += 20
  67.             End If
  68.         Else
  69.             Dim i As Integer = 2
  70.             If Minimize_Visible = True Then
  71.  
  72.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(60, 255, 255, 255)), New Rectangle(i, 2, 12, 14))
  73.                 Dim brush = New LinearGradientBrush(New Rectangle(i, 1, 12, 13), Color.FromArgb(230, 0, 0, 0), Color.FromArgb(60, 0, 0, 0), 90.0!)
  74.                 e.Graphics.FillEllipse(brush, New Rectangle(i - 1, 1, 14, 13))
  75.                 e.Graphics.FillEllipse(New SolidBrush(Minimize_Color), New Rectangle(i, 2, 12, 12))
  76.                 brush = New LinearGradientBrush(New Rectangle(i + 1, 3, 10, 4), Color.FromArgb(190, 255, 255, 255), Color.FromArgb(30, 255, 255, 255), 90.0!)
  77.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 1, 3, 10, 3))
  78.                 brush = New LinearGradientBrush(New Rectangle(i + 2, 10, 18, 4), Color.FromArgb(0, 255, 255, 255), Color.FromArgb(120, 255, 255, 255), 90.0!)
  79.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 2, 10, 8, 4))
  80.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(10, 23, 23, 23)), New Rectangle(i + 3, 5, 6, 6))
  81.                 i += 20
  82.             End If
  83.             If Maxmize_Visible = True Then
  84.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(60, 255, 255, 255)), New Rectangle(i, 2, 12, 14))
  85.                 Dim brush = New LinearGradientBrush(New Rectangle(i, 1, 12, 13), Color.FromArgb(230, 0, 0, 0), Color.FromArgb(60, 0, 0, 0), 90.0!)
  86.                 e.Graphics.FillEllipse(brush, New Rectangle(i - 1, 1, 14, 13))
  87.                 e.Graphics.FillEllipse(New SolidBrush(Maxmize_Color), New Rectangle(i, 2, 12, 12))
  88.                 brush = New LinearGradientBrush(New Rectangle(i + 1, 3, 10, 4), Color.FromArgb(190, 255, 255, 255), Color.FromArgb(30, 255, 255, 255), 90.0!)
  89.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 1, 3, 10, 3))
  90.                 brush = New LinearGradientBrush(New Rectangle(i + 2, 10, 18, 4), Color.FromArgb(0, 255, 255, 255), Color.FromArgb(120, 255, 255, 255), 90.0!)
  91.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 2, 10, 8, 4))
  92.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(10, 23, 23, 23)), New Rectangle(i + 3, 5, 6, 6))
  93.                 i += 20
  94.             End If
  95.             If Close_Visible = True Then
  96.  
  97.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(60, 255, 255, 255)), New Rectangle(i, 2, 12, 14))
  98.                 Dim brush = New LinearGradientBrush(New Rectangle(i, 1, 12, 13), Color.FromArgb(230, 0, 0, 0), Color.FromArgb(60, 0, 0, 0), 90.0!)
  99.                 e.Graphics.FillEllipse(brush, New Rectangle(i - 1, 1, 14, 13))
  100.                 e.Graphics.FillEllipse(New SolidBrush(Close_Color), New Rectangle(i, 2, 12, 12))
  101.                 brush = New LinearGradientBrush(New Rectangle(i + 1, 3, 10, 4), Color.FromArgb(190, 255, 255, 255), Color.FromArgb(30, 255, 255, 255), 90.0!)
  102.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 1, 3, 10, 3))
  103.                 brush = New LinearGradientBrush(New Rectangle(i + 2, 10, 18, 4), Color.FromArgb(0, 255, 255, 255), Color.FromArgb(120, 255, 255, 255), 90.0!)
  104.                 e.Graphics.FillEllipse(brush, New Rectangle(i + 2, 10, 8, 4))
  105.                 e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(10, 23, 23, 23)), New Rectangle(i + 3, 5, 6, 6))
  106.                 i += 20
  107.             End If
  108.         End If
  109.     End Sub
  110.  
  111.     Private Sub Skype_ControlBox_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown
  112.         If e.Button = MouseButtons.Left Then
  113.             If Left_To_Right = True Then
  114.                 Dim i As Integer = 2
  115.                 If Close_Visible = True Then
  116.                     If New Rectangle(i, 2, 12, 14).Contains(e.X, e.Y) Then
  117.                         Environment.Exit(0)
  118.                     End If
  119.                     i += 20
  120.                 End If
  121.                 If Maxmize_Visible = True Then
  122.                     If New Rectangle(i, 2, 12, 14).Contains(e.X, e.Y) Then
  123.                         If FindForm.WindowState = FormWindowState.Normal Then
  124.                             FindForm.WindowState = FormWindowState.Maximized
  125.                         Else
  126.                             FindForm.WindowState = FormWindowState.Normal
  127.                         End If
  128.                     End If
  129.                     i += 20
  130.                 End If
  131.                 If Minimize_Visible = True Then
  132.                     If New Rectangle(i, 2, 12, 14).Contains(e.X, e.Y) Then
  133.                         FindForm.WindowState = FormWindowState.Minimized
  134.                     End If
  135.                     i += 20
  136.                 End If
  137.             Else
  138.                 Dim i As Integer = 2
  139.                 If Minimize_Visible = True Then
  140.                     If New Rectangle(i, 2, 12, 14).Contains(e.X, e.Y) Then
  141.                         FindForm.WindowState = FormWindowState.Minimized
  142.                     End If
  143.                     i += 20
  144.                 End If
  145.                 If Maxmize_Visible = True Then
  146.                     If New Rectangle(i, 2, 12, 14).Contains(e.X, e.Y) Then
  147.                         If FindForm.WindowState = FormWindowState.Normal Then
  148.                             FindForm.WindowState = FormWindowState.Maximized
  149.                         Else
  150.                             FindForm.WindowState = FormWindowState.Normal
  151.                         End If
  152.                     End If
  153.                     i += 20
  154.                 End If
  155.                 If Close_Visible = True Then
  156.                     If New Rectangle(i, 2, 12, 14).Contains(e.X, e.Y) Then
  157.                         Environment.Exit(0)
  158.                     End If
  159.                     i += 20
  160.                 End If
  161.             End If
  162.         End If
  163.     End Sub
  164.  
  165. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement