Advertisement
ZeekoSec

[Bleu Theme] Update soon !

Feb 4th, 2015
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 9.07 KB | None | 0 0
  1. Imports System.Drawing
  2. Imports System.Drawing.Drawing2D
  3.  
  4. '[ ----------------- ]
  5. '  Theme: Bleu Theme
  6. '    -----------
  7. 'Creator: ZeekoSec
  8. 'HF UID: 2543606
  9. 'Created: 04-02-2015
  10. 'Le Credits
  11. '  [ ~ -------- ~ ]
  12. '       Earn
  13. '     Aeonhack
  14. '[ ----------------- ]
  15.  
  16. Class BleuTheme
  17.     Inherits ContainerControl
  18.  
  19. #Region " Mouse States "
  20.     Enum MouseState As Byte
  21.         None = 0
  22.         Over = 1
  23.         Down = 2
  24.         Block = 3
  25.     End Enum
  26.  
  27.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  28.         MyBase.OnMouseDown(e)
  29.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  30.             Dwn = True
  31.             MousePoint = e.Location
  32.         End If
  33.     End Sub
  34.  
  35.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  36.         MyBase.OnMouseUp(e)
  37.         Dwn = False
  38.     End Sub
  39.  
  40.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  41.         MyBase.OnMouseMove(e)
  42.         If Dwn Then
  43.             Parent.Location = MousePosition - MousePoint
  44.         End If
  45.     End Sub
  46. #End Region
  47.  
  48. #Region " Variables"
  49.     Private Dwn As Boolean = False
  50.     Private MousePoint As New Point(0, 0)
  51.     Private MoveHeight = 32
  52. #End Region
  53.  
  54.     Protected Overrides Sub OnCreateControl()
  55.         MyBase.OnCreateControl()
  56.         ParentForm.FormBorderStyle = FormBorderStyle.None
  57.         ParentForm.AllowTransparency = False
  58.         ParentForm.TransparencyKey = Color.Fuchsia
  59.         ParentForm.FindForm.StartPosition = FormStartPosition.CenterScreen
  60.         Dock = DockStyle.Fill
  61.         Invalidate()
  62.     End Sub
  63.  
  64.  
  65.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  66.         Dim P As GraphicsPath = New GraphicsPath()
  67.         Dim ArcRectangleWidth As Integer = Curve * 2
  68.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  69.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  70.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  71.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  72.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  73.         Return P
  74.     End Function
  75.  
  76.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  77.         MyBase.OnPaint(e)
  78.  
  79.         Dim G = e.Graphics
  80.         G.Clear(Color.Fuchsia)
  81.         G.FillPath(New SolidBrush(Color.FromArgb(40, 181, 202)), RoundRec(New Rectangle(0, 0, Width, Height), 3))
  82.         G.FillRectangle(New SolidBrush(Color.FromArgb(26, 26, 26)), 9, 32, Width - (9 * 2), Height - (32 + 9))
  83.         G.DrawString("BleuTheme", New Font("Arial", 11), New SolidBrush(Color.FromArgb(255, 255, 255)), New Point(7, 7))
  84.         G.Dispose()
  85.     End Sub
  86. End Class
  87. Class BleuButton
  88.     Inherits Button
  89.  
  90.     Sub New()
  91.         Size = New Point(110, 30)
  92.         Font = New Font("Arial", 9, FontStyle.Regular)
  93.         AutoEllipsis = False
  94.         ForeColor = Color.White
  95.         BackColor = Color.FromArgb(40, 181, 202)
  96.         FlatStyle = Windows.Forms.FlatStyle.Flat
  97.         FlatAppearance.BorderSize = 0
  98.         FlatAppearance.BorderColor = Color.FromArgb(22, 162, 183)
  99.         FlatAppearance.MouseDownBackColor = Color.FromArgb(24, 142, 159)
  100.         FlatAppearance.MouseOverBackColor = Color.FromArgb(40, 181, 202)
  101.     End Sub
  102. End Class
  103. Public Class BleuTextBox
  104.     Inherits Control
  105.  
  106. #Region " Variables "
  107.  
  108.     Public WithEvents BleuTextBox As New TextBox
  109.     Private _maxchars As Integer = 32767
  110.     Private _ReadOnly As Boolean
  111.     Private _Multiline As Boolean
  112.     Private ALNType As HorizontalAlignment
  113.     Private isPasswordMasked As Boolean = False
  114.  
  115. #End Region
  116. #Region " Properties "
  117.  
  118.     Public Shadows Property TextAlignment() As HorizontalAlignment
  119.         Get
  120.             Return ALNType
  121.         End Get
  122.         Set(ByVal Val As HorizontalAlignment)
  123.             ALNType = Val
  124.             Invalidate()
  125.         End Set
  126.     End Property
  127.     Public Shadows Property MaxLength() As Integer
  128.         Get
  129.             Return _maxchars
  130.         End Get
  131.         Set(ByVal Val As Integer)
  132.             _maxchars = Val
  133.             BleuTextBox.MaxLength = MaxLength
  134.             Invalidate()
  135.         End Set
  136.     End Property
  137.     Public Shadows Property UseSystemPasswordChar() As Boolean
  138.         Get
  139.             Return isPasswordMasked
  140.         End Get
  141.         Set(ByVal Val As Boolean)
  142.             BleuTextBox.UseSystemPasswordChar = UseSystemPasswordChar
  143.             isPasswordMasked = Val
  144.             Invalidate()
  145.         End Set
  146.     End Property
  147.     Property [ReadOnly]() As Boolean
  148.         Get
  149.             Return _ReadOnly
  150.         End Get
  151.         Set(ByVal value As Boolean)
  152.             _ReadOnly = value
  153.             If BleuTextBox IsNot Nothing Then
  154.                 BleuTextBox.ReadOnly = value
  155.             End If
  156.         End Set
  157.     End Property
  158.     Property Multiline() As Boolean
  159.         Get
  160.             Return _Multiline
  161.         End Get
  162.         Set(ByVal value As Boolean)
  163.             _Multiline = value
  164.             If BleuTextBox IsNot Nothing Then
  165.                 BleuTextBox.Multiline = value
  166.  
  167.                 If value Then
  168.                     BleuTextBox.Height = Height - 10
  169.                 Else
  170.                     Height = BleuTextBox.Height + 10
  171.                 End If
  172.             End If
  173.         End Set
  174.     End Property
  175.  
  176. #End Region
  177. #Region " EventArgs "
  178.  
  179.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  180.         MyBase.OnTextChanged(e)
  181.         Invalidate()
  182.     End Sub
  183.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  184.         MyBase.OnBackColorChanged(e)
  185.         BleuTextBox.BackColor = BackColor
  186.         Invalidate()
  187.     End Sub
  188.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  189.         MyBase.OnForeColorChanged(e)
  190.         BleuTextBox.ForeColor = ForeColor
  191.         Invalidate()
  192.     End Sub
  193.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  194.         MyBase.OnFontChanged(e)
  195.         BleuTextBox.Font = Font
  196.     End Sub
  197.     Private Sub _OnKeyDown(ByVal Obj As Object, ByVal e As KeyEventArgs)
  198.         If e.Control AndAlso e.KeyCode = Keys.A Then
  199.             BleuTextBox.SelectAll()
  200.             e.SuppressKeyPress = True
  201.         End If
  202.         If e.Control AndAlso e.KeyCode = Keys.C Then
  203.             BleuTextBox.Copy()
  204.             e.SuppressKeyPress = True
  205.         End If
  206.     End Sub
  207.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  208.         MyBase.OnResize(e)
  209.         If _Multiline Then
  210.             BleuTextBox.Height = Height - 10
  211.         Else
  212.             Height = BleuTextBox.Height + 10
  213.         End If
  214.     End Sub
  215.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  216.         MyBase.OnGotFocus(e)
  217.         BleuTextBox.Focus()
  218.     End Sub
  219.     Sub _TextChanged() Handles BleuTextBox.TextChanged
  220.         Text = BleuTextBox.Text
  221.     End Sub
  222.     Sub _BaseTextChanged() Handles MyBase.TextChanged
  223.         BleuTextBox.Text = Text
  224.     End Sub
  225.  
  226. #End Region
  227.  
  228.     Sub AddTextBox()
  229.         With BleuTextBox
  230.             .BackColor = BackColor
  231.             .ForeColor = ForeColor
  232.             .Size = New Size(Width - 10, 27)
  233.             .Location = New Point(7, 5)
  234.             .Text = String.Empty
  235.             .BorderStyle = BorderStyle.None
  236.             .TextAlign = HorizontalAlignment.Left
  237.             .Font = New Font("Tahoma", 10)
  238.             .UseSystemPasswordChar = UseSystemPasswordChar
  239.             .Multiline = False
  240.         End With
  241.         AddHandler BleuTextBox.KeyDown, AddressOf _OnKeyDown
  242.     End Sub
  243.  
  244.     Sub New()
  245.         MyBase.New()
  246.  
  247.         AddTextBox()
  248.         Controls.Add(BleuTextBox)
  249.  
  250.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  251.         SetStyle(ControlStyles.UserPaint, True)
  252.  
  253.         BackColor = Color.FromArgb(26, 26, 26)
  254.         ForeColor = Color.FromArgb(225, 255, 255)
  255.         Text = Nothing
  256.         Font = New Font("Arial", 9)
  257.         Size = New Size(135, 27)
  258.         DoubleBuffered = True ' Cut off border flicker
  259.     End Sub
  260.  
  261.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  262.         Dim B As New Bitmap(Width, Height)
  263.         Dim G As Graphics = Graphics.FromImage(B)
  264.         G.SmoothingMode = SmoothingMode.HighQuality
  265.         'Height = 27
  266.  
  267.         With BleuTextBox
  268.             .Width = Width - 10
  269.             .TextAlign = TextAlignment
  270.             .UseSystemPasswordChar = UseSystemPasswordChar
  271.             '.Height = 27
  272.         End With
  273.  
  274.         G.Clear(Color.Transparent)
  275.         G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(40, 181, 202))), New Rectangle(0, 0, Width - 1, Height - 1))
  276.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  277.         G.Dispose() : B.Dispose()
  278.     End Sub
  279. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement