Advertisement
xZ3ROxPROJ3CTx

RecuperareII Theme [VB.NET] (11.15.2012)

Nov 15th, 2012
5,773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 32.21 KB | None | 0 0
  1. Imports System, System.IO, System.Collections.Generic, System.Runtime.InteropServices, System.ComponentModel
  2. Imports System.Drawing, System.Drawing.Drawing2D, System.Drawing.Imaging, System.Windows.Forms
  3.  
  4. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  5.  
  6. '--------------------- [ Theme ] --------------------
  7. 'Creator: Recuperare
  8. 'Contact: cschaefer2183 (Skype)
  9. 'Created: 01.02.2012
  10. 'Changed: 01.02.2012
  11. '-------------------- [ /Theme ] ---------------------
  12.  
  13. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  14.  
  15. #Region " GLOBAL FUNCTIONS "
  16. Module Draw
  17.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  18.         Dim P As GraphicsPath = New GraphicsPath()
  19.         Dim ArcRectangleWidth As Integer = Curve * 2
  20.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  21.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  22.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  23.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  24.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  25.         Return P
  26.     End Function
  27.     Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
  28.         Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  29.         Dim P As GraphicsPath = New GraphicsPath()
  30.         Dim ArcRectangleWidth As Integer = Curve * 2
  31.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  32.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  33.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  34.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  35.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  36.         Return P
  37.     End Function
  38. End Module
  39.  
  40. Enum MouseState As Byte
  41.     None = 0
  42.     Over = 1
  43.     Down = 2
  44.     Block = 3
  45. End Enum
  46. #End Region
  47.  
  48.  
  49. Public Class RecuperareIIButton : Inherits Control
  50.  
  51. #Region " Control Help - MouseState & Flicker Control"
  52.     Private State As MouseState = MouseState.None
  53.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  54.         MyBase.OnMouseEnter(e)
  55.         State = MouseState.Over
  56.         Invalidate()
  57.     End Sub
  58.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  59.         MyBase.OnMouseDown(e)
  60.         State = MouseState.Down
  61.         Invalidate()
  62.     End Sub
  63.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  64.         MyBase.OnMouseLeave(e)
  65.         State = MouseState.None
  66.         Invalidate()
  67.     End Sub
  68.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  69.         MyBase.OnMouseUp(e)
  70.         State = MouseState.Over
  71.         Invalidate()
  72.     End Sub
  73.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  74.         MyBase.OnTextChanged(e)
  75.         Invalidate()
  76.     End Sub
  77.  
  78. #End Region
  79.  
  80.     Sub New()
  81.         MyBase.New()
  82.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  83.         BackColor = Color.Transparent
  84.         ForeColor = Color.FromArgb(27, 94, 137)
  85.         DoubleBuffered = True
  86.         Size = New Size(75, 23)
  87.         Font = New Font("Verdana", 6.75F, FontStyle.Bold)
  88.     End Sub
  89.  
  90.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  91.         Dim B As New Bitmap(Width, Height)
  92.         Dim G As Graphics = Graphics.FromImage(B)
  93.         Dim ClientRectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  94.         MyBase.OnPaint(e)
  95.  
  96.         G.SmoothingMode = SmoothingMode.HighQuality
  97.         G.Clear(BackColor)
  98.  
  99.         Select Case State
  100.             Case MouseState.None 'Mouse None
  101.                 Dim bodyGrad As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 2), Color.FromArgb(245, 245, 245), Color.FromArgb(230, 230, 230), 90S)
  102.                 G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
  103.                 Dim bodyInBorder As New LinearGradientBrush(New Rectangle(1, 1, Width - 3, Height - 4), Color.FromArgb(252, 252, 252), Color.FromArgb(249, 249, 249), 90S)
  104.                 G.DrawRectangle(New Pen(bodyInBorder), New Rectangle(1, 1, Width - 3, Height - 4))
  105.                 G.DrawRectangle(New Pen(Color.FromArgb(189, 189, 189)), New Rectangle(0, 0, Width - 1, Height - 2))
  106.                 G.DrawLine(New Pen(Color.FromArgb(200, 168, 168, 168)), New Point(1, Height - 1), New Point(Width - 2, Height - 1))
  107.                 ForeColor = Color.FromArgb(27, 94, 137)
  108.                 G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(200, Color.White)), New Rectangle(-1, 0, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  109.             Case MouseState.Over 'Mouse Hover
  110.                 Dim bodyGrad As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 2), Color.FromArgb(70, 153, 205), Color.FromArgb(53, 124, 170), 90S)
  111.                 G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
  112.                 Dim bodyInBorder As New LinearGradientBrush(New Rectangle(1, 1, Width - 3, Height - 4), Color.FromArgb(88, 168, 221), Color.FromArgb(76, 149, 194), 90S)
  113.                 G.DrawRectangle(New Pen(bodyInBorder), New Rectangle(1, 1, Width - 3, Height - 4))
  114.                 G.DrawRectangle(New Pen(Color.FromArgb(38, 93, 131)), New Rectangle(0, 0, Width - 1, Height - 2))
  115.                 G.DrawLine(New Pen(Color.FromArgb(200, 25, 73, 109)), New Point(1, Height - 1), New Point(Width - 2, Height - 1))
  116.                 ForeColor = Color.White
  117.                 G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(200, Color.Black)), New Rectangle(-1, -2, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  118.             Case MouseState.Down 'Mouse Down
  119.                 Dim bodyGrad As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 2), Color.FromArgb(70, 153, 205), Color.FromArgb(53, 124, 170), 270S)
  120.                 G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
  121.                 Dim bodyInBorder As New LinearGradientBrush(New Rectangle(1, 1, Width - 3, Height - 4), Color.FromArgb(88, 168, 221), Color.FromArgb(76, 149, 194), 270S)
  122.                 G.DrawRectangle(New Pen(bodyInBorder), New Rectangle(1, 1, Width - 3, Height - 4))
  123.                 G.DrawRectangle(New Pen(Color.FromArgb(38, 93, 131)), New Rectangle(0, 0, Width - 1, Height - 2))
  124.                 G.DrawLine(New Pen(Color.FromArgb(200, 25, 73, 109)), New Point(1, Height - 1), New Point(Width - 2, Height - 1))
  125.                 ForeColor = Color.White
  126.                 G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(200, Color.Black)), New Rectangle(-1, -2, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  127.         End Select
  128.         G.DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(-1, -1, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  129.  
  130.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  131.         G.Dispose() : B.Dispose()
  132.     End Sub
  133. End Class
  134.  
  135. Public Class RecuperareIIComboBox : Inherits ComboBox
  136. #Region " Control Help - Properties & Flicker Control "
  137.     Private _StartIndex As Integer = 0
  138.     Public Property StartIndex As Integer
  139.         Get
  140.             Return _StartIndex
  141.         End Get
  142.         Set(ByVal value As Integer)
  143.             _StartIndex = value
  144.             Try
  145.                 MyBase.SelectedIndex = value
  146.             Catch
  147.             End Try
  148.             Invalidate()
  149.         End Set
  150.     End Property
  151.     Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  152.         e.DrawBackground()
  153.         Try
  154.             If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  155.                 e.Graphics.FillRectangle(New SolidBrush(_highlightColor), e.Bounds)
  156.                 Dim gloss As New LinearGradientBrush(e.Bounds, Color.FromArgb(15, Color.White), Color.FromArgb(0, Color.White), 90S)
  157.                 e.Graphics.FillRectangle(gloss, New Rectangle(New Point(e.Bounds.X, e.Bounds.Y), New Size(e.Bounds.Width, e.Bounds.Height)))
  158.                 e.Graphics.DrawRectangle(New Pen(Color.FromArgb(50, Color.Black)) With {.DashStyle = DashStyle.Dot}, New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1))
  159.             Else
  160.                 e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 255, 255)), e.Bounds)
  161.             End If
  162.             Using b As New SolidBrush(Color.Black)
  163.                 e.Graphics.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), e.Font, b, New Rectangle(e.Bounds.X + 2, e.Bounds.Y, e.Bounds.Width - 4, e.Bounds.Height))
  164.             End Using
  165.         Catch
  166.         End Try
  167.         e.DrawFocusRectangle()
  168.     End Sub
  169.     Protected Sub DrawTriangle(ByVal Clr As Color, ByVal FirstPoint As Point, ByVal SecondPoint As Point, ByVal ThirdPoint As Point, ByVal G As Graphics)
  170.         Dim points As New List(Of Point)()
  171.         points.Add(FirstPoint)
  172.         points.Add(SecondPoint)
  173.         points.Add(ThirdPoint)
  174.         G.FillPolygon(New SolidBrush(Clr), points.ToArray)
  175.     End Sub
  176.     Private _highlightColor As Color = Color.FromArgb(121, 176, 214)
  177.     Public Property ItemHighlightColor() As Color
  178.         Get
  179.             Return _highlightColor
  180.         End Get
  181.         Set(ByVal v As Color)
  182.             _highlightColor = v
  183.             Invalidate()
  184.         End Set
  185.     End Property
  186. #End Region
  187.  
  188.     Sub New()
  189.         MyBase.New()
  190.         SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  191.         ControlStyles.ResizeRedraw Or _
  192.         ControlStyles.UserPaint Or _
  193.         ControlStyles.DoubleBuffer Or _
  194.         ControlStyles.SupportsTransparentBackColor, True)
  195.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  196.         BackColor = Color.Transparent
  197.         ForeColor = Color.FromArgb(27, 94, 137)
  198.         Font = New Font("Verdana", 6.75F, FontStyle.Bold)
  199.         DropDownStyle = ComboBoxStyle.DropDownList
  200.         DoubleBuffered = True
  201.         Size = New Size(Width, 21)
  202.         ItemHeight = 16
  203.     End Sub
  204.  
  205.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  206.         Dim B As New Bitmap(Width, Height)
  207.         Dim G As Graphics = Graphics.FromImage(B)
  208.         G.SmoothingMode = SmoothingMode.HighQuality
  209.  
  210.  
  211.         G.Clear(BackColor)
  212.                 Dim bodyGradNone As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 2), Color.FromArgb(245, 245, 245), Color.FromArgb(230, 230, 230), 90S)
  213.                 G.FillRectangle(bodyGradNone, bodyGradNone.Rectangle)
  214.                 Dim bodyInBorderNone As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 3), Color.FromArgb(252, 252, 252), Color.FromArgb(249, 249, 249), 90S)
  215.                 G.DrawRectangle(New Pen(bodyInBorderNone), New Rectangle(1, 1, Width - 3, Height - 4))
  216.                 G.DrawRectangle(New Pen(Color.FromArgb(189, 189, 189)), New Rectangle(0, 0, Width - 1, Height - 2))
  217.                 G.DrawLine(New Pen(Color.FromArgb(200, 168, 168, 168)), New Point(1, Height - 1), New Point(Width - 2, Height - 1))
  218.                 DrawTriangle(Color.FromArgb(121, 176, 214), New Point(Width - 14, 8), New Point(Width - 7, 8), New Point(Width - 11, 12), G)
  219.                 G.DrawLine(New Pen(Color.FromArgb(27, 94, 137)), New Point(Width - 14, 8), New Point(Width - 8, 8))
  220.  
  221.                 'Draw Separator line
  222.                 G.DrawLine(New Pen(Color.White), New Point(Width - 22, 1), New Point(Width - 22, Height - 3))
  223.                 G.DrawLine(New Pen(Color.FromArgb(189, 189, 189)), New Point(Width - 21, 1), New Point(Width - 21, Height - 3))
  224.                 G.DrawLine(New Pen(Color.White), New Point(Width - 20, 1), New Point(Width - 20, Height - 3))
  225.         Try
  226.             G.DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(5, -1, Width - 20, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  227.         Catch
  228.         End Try
  229.  
  230.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  231.         G.Dispose() : B.Dispose()
  232.     End Sub
  233. End Class
  234.  
  235. Public Class RecuperareIITextBox : Inherits Control
  236.     Dim WithEvents txtbox As New TextBox
  237.  
  238. #Region " Control Help - Properties & Flicker Control "
  239.     Private _passmask As Boolean = False
  240.     Public Shadows Property UseSystemPasswordChar() As Boolean
  241.         Get
  242.             Return _passmask
  243.         End Get
  244.         Set(ByVal v As Boolean)
  245.             txtbox.UseSystemPasswordChar = UseSystemPasswordChar
  246.             _passmask = v
  247.             Invalidate()
  248.         End Set
  249.     End Property
  250.     Private _maxchars As Integer = 32767
  251.     Public Shadows Property MaxLength() As Integer
  252.         Get
  253.             Return _maxchars
  254.         End Get
  255.         Set(ByVal v As Integer)
  256.             _maxchars = v
  257.             txtbox.MaxLength = MaxLength
  258.             Invalidate()
  259.         End Set
  260.     End Property
  261.     Private _align As HorizontalAlignment
  262.     Public Shadows Property TextAlignment() As HorizontalAlignment
  263.         Get
  264.             Return _align
  265.         End Get
  266.         Set(ByVal v As HorizontalAlignment)
  267.             _align = v
  268.             Invalidate()
  269.         End Set
  270.     End Property
  271.     Private _multiline As Boolean = False
  272.     Public Shadows Property MultiLine() As Boolean
  273.         Get
  274.             Return _multiline
  275.         End Get
  276.         Set(ByVal value As Boolean)
  277.             _multiline = value
  278.             Invalidate()
  279.         End Set
  280.     End Property
  281.  
  282.  
  283.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  284.         MyBase.OnTextChanged(e)
  285.         Invalidate()
  286.     End Sub
  287.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  288.         MyBase.OnBackColorChanged(e)
  289.         txtbox.BackColor = BackColor
  290.         Invalidate()
  291.     End Sub
  292.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  293.         MyBase.OnForeColorChanged(e)
  294.         txtbox.ForeColor = ForeColor
  295.         Invalidate()
  296.     End Sub
  297.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  298.         MyBase.OnFontChanged(e)
  299.         txtbox.Font = Font
  300.     End Sub
  301.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  302.         MyBase.OnGotFocus(e)
  303.         txtbox.Focus()
  304.     End Sub
  305.     Sub TextChngTxtBox() Handles txtbox.TextChanged
  306.         Text = txtbox.Text
  307.     End Sub
  308.     Sub TextChng() Handles MyBase.TextChanged
  309.         txtbox.Text = Text
  310.     End Sub
  311.     Sub NewTextBox()
  312.         With txtbox
  313.             .Multiline = False
  314.             .BackColor = Color.FromArgb(43, 43, 43)
  315.             .ForeColor = ForeColor
  316.             .Text = String.Empty
  317.             .TextAlign = HorizontalAlignment.Center
  318.             .BorderStyle = BorderStyle.None
  319.             .Location = New Point(5, 4)
  320.             .Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
  321.             .Size = New Size(Width - 10, Height - 11)
  322.             .UseSystemPasswordChar = UseSystemPasswordChar
  323.         End With
  324.  
  325.     End Sub
  326. #End Region
  327.  
  328.     Sub New()
  329.         MyBase.New()
  330.  
  331.         NewTextBox()
  332.         Controls.Add(txtbox)
  333.  
  334.         SetStyle(ControlStyles.UserPaint, True)
  335.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  336.  
  337.         Text = ""
  338.         BackColor = Color.FromArgb(233, 233, 233)
  339.         ForeColor = Color.FromArgb(27, 94, 137)
  340.         Font = New Font("Verdana", 6.75F, FontStyle.Bold)
  341.         Size = New Size(135, 35)
  342.         DoubleBuffered = True
  343.     End Sub
  344.  
  345.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  346.         Dim B As New Bitmap(Width, Height)
  347.         Dim G As Graphics = Graphics.FromImage(B)
  348.         G.SmoothingMode = SmoothingMode.HighQuality
  349.  
  350.         Height = txtbox.Height + 10
  351.         With txtbox
  352.             .Width = Width - 10
  353.             .TextAlign = TextAlignment
  354.             .UseSystemPasswordChar = UseSystemPasswordChar
  355.         End With
  356.  
  357.         G.Clear(Color.Transparent)
  358.  
  359.         Dim innerBorderBrush As New LinearGradientBrush(New Rectangle(1, 1, Width - 3, Height - 3), Color.FromArgb(220, 220, 220), Color.FromArgb(228, 228, 228), 90S)
  360.         Dim innerBorderPen As New Pen(innerBorderBrush)
  361.         G.DrawRectangle(innerBorderPen, New Rectangle(1, 1, Width - 3, Height - 3))
  362.         G.DrawLine(New Pen(Color.FromArgb(191, 191, 191)), New Point(1, 1), New Point(Width - 3, 1))
  363.  
  364.         G.DrawRectangle(New Pen(Color.FromArgb(254, 254, 254)), New Rectangle(0, 0, Width - 1, Height - 1))
  365.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  366.         G.Dispose() : B.Dispose()
  367.     End Sub
  368. End Class
  369.  
  370. <DefaultEvent("CheckedChanged")> Public Class RecuperareIICheckBox : Inherits Control
  371.  
  372. #Region " Control Help - MouseState & Flicker Control"
  373.     Private Mouse As New Point(0, 0)
  374.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  375.         MyBase.OnTextChanged(e)
  376.         Invalidate()
  377.     End Sub
  378.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  379.         MyBase.OnMouseMove(e)
  380.         Mouse = e.Location : Invalidate()
  381.     End Sub
  382.     Private _Checked As Boolean
  383.     Property Checked() As Boolean
  384.         Get
  385.             Return _Checked
  386.         End Get
  387.         Set(ByVal value As Boolean)
  388.             _Checked = value
  389.             Invalidate()
  390.         End Set
  391.     End Property
  392.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  393.         MyBase.OnResize(e)
  394.         Height = 14
  395.     End Sub
  396.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  397.         If Mouse.X < Height - 1 Then
  398.             _Checked = Not _Checked
  399.             RaiseEvent CheckedChanged(Me)
  400.         End If
  401.         MyBase.OnClick(e)
  402.     End Sub
  403.     Event CheckedChanged(ByVal sender As Object)
  404. #End Region
  405.  
  406.     Sub New()
  407.         MyBase.New()
  408.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  409.         Font = New Font("Verdana", 6.75F, FontStyle.Bold)
  410.         BackColor = Color.Transparent
  411.         ForeColor = Color.FromArgb(27, 94, 137)
  412.         Size = New Size(145, 16)
  413.         DoubleBuffered = True
  414.     End Sub
  415.  
  416.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  417.         Dim B As New Bitmap(Width, Height)
  418.         Dim G As Graphics = Graphics.FromImage(B)
  419.  
  420.         Dim checkBoxRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  421.         G.SmoothingMode = SmoothingMode.HighQuality
  422.  
  423.         G.Clear(Parent.FindForm.BackColor)
  424.  
  425.         Dim bodyGrad As New LinearGradientBrush(checkBoxRectangle, Color.FromArgb(245, 245, 245), Color.FromArgb(231, 231, 231), 90S)
  426.         G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
  427.         G.DrawRectangle(New Pen(Color.FromArgb(189, 189, 189)), New Rectangle(0, 0, Height - 1, Height - 2))
  428.         G.DrawRectangle(New Pen(Color.FromArgb(252, 252, 252)), New Rectangle(1, 1, Height - 3, Height - 4))
  429.         G.DrawLine(New Pen(Color.FromArgb(168, 168, 168)), New Point(1, Height - 1), New Point(Height - 2, Height - 1))
  430.  
  431.         If Checked Then
  432.             Dim chkPoly As Rectangle = New Rectangle(checkBoxRectangle.X + checkBoxRectangle.Width / 4, checkBoxRectangle.Y + checkBoxRectangle.Height / 4, checkBoxRectangle.Width \ 2, checkBoxRectangle.Height \ 2)
  433.             Dim Poly() As Point = {New Point(chkPoly.X, chkPoly.Y + chkPoly.Height \ 2), _
  434.                            New Point(chkPoly.X + chkPoly.Width \ 2, chkPoly.Y + chkPoly.Height), _
  435.                            New Point(chkPoly.X + chkPoly.Width, chkPoly.Y)}
  436.             G.SmoothingMode = SmoothingMode.HighQuality
  437.             Dim P1 As New Pen(Color.FromArgb(27, 94, 137), 2)
  438.             Dim chkGrad As New LinearGradientBrush(chkPoly, Color.FromArgb(200, 200, 200), Color.FromArgb(255, 255, 255), 0S)
  439.             For i = 0 To Poly.Length - 2
  440.                 'G.DrawLine(P1, Poly(i), Poly(i + 1))
  441.             Next
  442.             G.DrawString("a", New Font("Marlett", 10.75), New SolidBrush(Color.FromArgb(220, ForeColor)), New Rectangle(-2, -1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  443.         End If
  444.  
  445.         G.DrawString(Text, Font, New SolidBrush(ForeColor), New Point(16, 0), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  446.  
  447.  
  448.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  449.         G.Dispose() : B.Dispose()
  450.  
  451.     End Sub
  452.  
  453. End Class
  454.  
  455. <DefaultEvent("CheckedChanged")> Public Class RecuperareIIRadioButton : Inherits Control
  456.  
  457. #Region " Control Help - MouseState & Flicker Control"
  458.     Private R1 As Rectangle
  459.     Private G1 As LinearGradientBrush
  460.     Private Mouse As New Point(0, 0)
  461.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  462.         MyBase.OnResize(e)
  463.         Height = 14
  464.     End Sub
  465.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  466.         MyBase.OnTextChanged(e)
  467.         Invalidate()
  468.     End Sub
  469.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  470.         MyBase.OnMouseMove(e)
  471.         Mouse = e.Location : Invalidate()
  472.     End Sub
  473.     Private _Checked As Boolean
  474.     Property Checked() As Boolean
  475.         Get
  476.             Return _Checked
  477.         End Get
  478.         Set(ByVal value As Boolean)
  479.             _Checked = value
  480.             InvalidateControls()
  481.             RaiseEvent CheckedChanged(Me)
  482.             Invalidate()
  483.         End Set
  484.     End Property
  485.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  486.         If Mouse.X < Height - 1 Then
  487.             If Not _Checked Then Checked = True
  488.             RaiseEvent CheckedChanged(Me)
  489.         End If
  490.         MyBase.OnClick(e)
  491.     End Sub
  492.     Event CheckedChanged(ByVal sender As Object)
  493.     Protected Overrides Sub OnCreateControl()
  494.         MyBase.OnCreateControl()
  495.         InvalidateControls()
  496.     End Sub
  497.     Private Sub InvalidateControls()
  498.         If Not IsHandleCreated OrElse Not _Checked Then Return
  499.  
  500.         For Each C As Control In Parent.Controls
  501.             If C IsNot Me AndAlso TypeOf C Is RecuperareIIRadioButton Then
  502.                 DirectCast(C, RecuperareIIRadioButton).Checked = False
  503.             End If
  504.         Next
  505.     End Sub
  506. #End Region
  507.  
  508.     Sub New()
  509.         MyBase.New()
  510.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  511.         BackColor = Color.Transparent
  512.         ForeColor = Color.FromArgb(27, 94, 137)
  513.         Font = New Font("Verdana", 6.75F, FontStyle.Bold)
  514.         Size = New Size(152, 14)
  515.         DoubleBuffered = True
  516.     End Sub
  517.  
  518.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  519.         Dim B As New Bitmap(Width, Height)
  520.         Dim G As Graphics = Graphics.FromImage(B)
  521.  
  522.         G.SmoothingMode = SmoothingMode.HighQuality
  523.         G.Clear(Parent.FindForm.BackColor)
  524.  
  525.         G.DrawEllipse(New Pen(Color.FromArgb(168, 168, 168)), New Rectangle(0, 0, Height - 2, Height - 1))
  526.         Dim bgGrad As New LinearGradientBrush(New Rectangle(0, 0, Height - 2, Height - 2), Color.FromArgb(245, 245, 245), Color.FromArgb(231, 231, 231), 90S)
  527.         G.FillEllipse(bgGrad, New Rectangle(0, 0, Height - 2, Height - 2))
  528.         G.DrawEllipse(New Pen(Color.FromArgb(252, 252, 252)), New Rectangle(1, 1, Height - 4, Height - 4))
  529.  
  530.         If Checked Then
  531.             G.FillEllipse(New SolidBrush(Color.FromArgb(27, 94, 137)), New Rectangle(3, 3, Height - 8, Height - 8))
  532.             G.FillEllipse(New SolidBrush(Color.FromArgb(150, 118, 177, 211)), New Rectangle(4, 4, Height - 10, Height - 10))
  533.         End If
  534.  
  535.         G.DrawString(Text, Font, New SolidBrush(ForeColor), New Point(16, 1), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  536.  
  537.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  538.         G.Dispose() : B.Dispose()
  539.     End Sub
  540.  
  541. End Class
  542.  
  543. Public Class RecuperareIIStatusBar : Inherits Control
  544.  
  545.     Protected Overrides Sub CreateHandle()
  546.         MyBase.CreateHandle()
  547.         Dock = DockStyle.Bottom
  548.     End Sub
  549.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  550.         MyBase.OnResize(e) : Invalidate()
  551.     End Sub
  552.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  553.         MyBase.OnTextChanged(e) : Invalidate()
  554.     End Sub
  555.  
  556.     Sub New()
  557.         MyBase.New()
  558.         Font = New Font("Verdana", 6.75F, FontStyle.Bold)
  559.         ForeColor = Color.FromArgb(27, 94, 137)
  560.         Size = New Size(Width, 20)
  561.         DoubleBuffered = True
  562.     End Sub
  563.  
  564.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  565.         Dim B As New Bitmap(Width, Height)
  566.         Dim G As Graphics = Graphics.FromImage(B)
  567.         MyBase.OnPaint(e)
  568.  
  569.         Dim bodyGradNone As New LinearGradientBrush(New Rectangle(0, 1, Width, Height - 1), Color.FromArgb(245, 245, 245), Color.FromArgb(230, 230, 230), 90S)
  570.         G.FillRectangle(bodyGradNone, bodyGradNone.Rectangle)
  571.         Dim bodyInBorderNone As New LinearGradientBrush(New Rectangle(1, 1, Width - 3, Height - 3), Color.FromArgb(200, 252, 252, 252), Color.FromArgb(200, 249, 249, 249), 90S)
  572.         G.DrawRectangle(New Pen(bodyInBorderNone), New Rectangle(1, 1, Width - 3, Height - 3))
  573.         G.DrawRectangle(New Pen(Color.FromArgb(189, 189, 189)), New Rectangle(0, 0, Width - 1, Height - 1))
  574.  
  575.         G.DrawString(Text, Font, New SolidBrush(ForeColor), New Point(4, 4), StringFormat.GenericDefault)
  576.  
  577.         e.Graphics.DrawImage(B, 0, 0)
  578.         G.Dispose() : B.Dispose()
  579.     End Sub
  580. End Class
  581.  
  582. Public Class RecuperareIINumericUpDown : Inherits Control
  583.  
  584. #Region " Properties & Flicker Control "
  585.     Private State As New MouseState
  586.     Private X As Integer
  587.     Private Y As Integer
  588.     Private _Value As Long
  589.     Private _Max As Long
  590.     Private _Min As Long
  591.     Private Typing As Boolean
  592.     Public Property Value As Long
  593.         Get
  594.             Return _Value
  595.         End Get
  596.         Set(ByVal V As Long)
  597.             If V <= _Max And V >= _Min Then _Value = V
  598.             Invalidate()
  599.         End Set
  600.     End Property
  601.     Public Property Maximum As Long
  602.         Get
  603.             Return _Max
  604.         End Get
  605.         Set(ByVal V As Long)
  606.             If V > _Min Then _Max = V
  607.             If _Value > _Max Then _Value = _Max
  608.             Invalidate()
  609.         End Set
  610.     End Property
  611.     Public Property Minimum As Long
  612.         Get
  613.             Return _Min
  614.         End Get
  615.         Set(ByVal V As Long)
  616.             If V < _Max Then _Min = V
  617.             If _Value < _Min Then _Value = _Min
  618.             Invalidate()
  619.         End Set
  620.     End Property
  621.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  622.         MyBase.OnMouseMove(e)
  623.         X = e.Location.X
  624.         Y = e.Location.Y
  625.         Invalidate()
  626.         If e.X < Width - 23 Then Cursor = Cursors.IBeam Else Cursor = Cursors.Default
  627.     End Sub
  628.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  629.         MyBase.OnResize(e)
  630.         Me.Height = 30
  631.     End Sub
  632.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  633.         MyBase.OnMouseClick(e)
  634.         If X > Me.Width - 21 AndAlso X < Me.Width - 3 Then
  635.             If Y < 15 Then
  636.                 If (Value + 1) <= _Max Then _Value += 1
  637.             Else
  638.                 If (Value - 1) >= _Min Then _Value -= 1
  639.             End If
  640.         Else
  641.             Typing = Not Typing
  642.             Focus()
  643.         End If
  644.         Invalidate()
  645.     End Sub
  646.     Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
  647.         MyBase.OnKeyPress(e)
  648.         Try
  649.             If Typing Then _Value = CStr(CStr(_Value) & e.KeyChar.ToString)
  650.             If _Value > _Max Then _Value = _Max
  651.         Catch ex As Exception : End Try
  652.     End Sub
  653.     Protected Overrides Sub OnKeyup(ByVal e As System.Windows.Forms.KeyEventArgs)
  654.         MyBase.OnKeyUp(e)
  655.         If e.KeyCode = Keys.Up Then
  656.             If (Value + 1) <= _Max Then _Value += 1
  657.             Invalidate()
  658.         ElseIf e.KeyCode = Keys.Down Then
  659.             If (Value - 1) >= _Min Then _Value -= 1
  660.         ElseIf e.KeyCode = Keys.Back Then
  661.             Dim tmp As String = _Value.ToString()
  662.             tmp = tmp.Remove(Convert.ToInt32(tmp.Length - 1))
  663.             If (tmp.Length = 0) Then tmp = "0"
  664.             _Value = Convert.ToInt32(tmp)
  665.         End If
  666.         Invalidate()
  667.     End Sub
  668.     Protected Sub DrawTriangle(ByVal Clr As Color, ByVal FirstPoint As Point, ByVal SecondPoint As Point, ByVal ThirdPoint As Point, ByVal G As Graphics)
  669.         Dim points As New List(Of Point)()
  670.         points.Add(FirstPoint)
  671.         points.Add(SecondPoint)
  672.         points.Add(ThirdPoint)
  673.         G.FillPolygon(New SolidBrush(Clr), points.ToArray)
  674.     End Sub
  675. #End Region
  676.  
  677.     Sub New()
  678.         _Max = 9999999
  679.         _Min = 0
  680.         Cursor = Cursors.IBeam
  681.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  682.         BackColor = Color.FromArgb(233, 233, 233)
  683.         ForeColor = Color.FromArgb(27, 94, 137)
  684.         DoubleBuffered = True
  685.         Font = New Font("Verdana", 6.75F, FontStyle.Bold)
  686.  
  687.     End Sub
  688.  
  689.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  690.         Dim B As New Bitmap(Width, Height)
  691.         Dim G As Graphics = Graphics.FromImage(B)
  692.  
  693.         G.Clear(BackColor)
  694.         G.SmoothingMode = SmoothingMode.HighQuality
  695.  
  696.         Dim innerBorderBrush As New LinearGradientBrush(New Rectangle(1, 1, Width - 3, Height - 3), Color.FromArgb(220, 220, 220), Color.FromArgb(228, 228, 228), 90S)
  697.         Dim innerBorderPen As New Pen(innerBorderBrush)
  698.         G.DrawRectangle(innerBorderPen, New Rectangle(1, 1, Width - 3, Height - 3))
  699.         G.DrawLine(New Pen(Color.FromArgb(191, 191, 191)), New Point(1, 1), New Point(Width - 3, 1))
  700.  
  701.         G.DrawRectangle(New Pen(Color.FromArgb(254, 254, 254)), New Rectangle(0, 0, Width - 1, Height - 1))
  702.  
  703.  
  704.         Dim buttonGradient As New LinearGradientBrush(New Rectangle(Width - 23, 4, 19, 21), Color.FromArgb(245, 245, 245), Color.FromArgb(232, 232, 232), 90S)
  705.         G.FillRectangle(buttonGradient, buttonGradient.Rectangle)
  706.         G.DrawRectangle(New Pen(Color.FromArgb(252, 252, 252)), New Rectangle(Width - 22, 5, 17, 19))
  707.         G.DrawRectangle(New Pen(Color.FromArgb(190, 190, 190)), New Rectangle(Width - 23, 4, 19, 21))
  708.         G.DrawLine(New Pen(Color.FromArgb(200, 167, 167, 167)), New Point(Width - 22, Height - 4), New Point(Width - 5, Height - 4))
  709.         G.DrawLine(New Pen(Color.FromArgb(188, 188, 188)), New Point(Width - 22, Height - 16), New Point(Width - 5, Height - 16))
  710.         G.DrawLine(New Pen(Color.FromArgb(252, 252, 252)), New Point(Width - 22, Height - 15), New Point(Width - 5, Height - 15))
  711.  
  712.  
  713.         'Top Triangle
  714.         DrawTriangle(Color.FromArgb(27, 94, 137), New Point(Width - 17, 18), New Point(Width - 9, 18), New Point(Width - 13, 21), G)
  715.  
  716.         'Bottom Triangle
  717.         DrawTriangle(Color.FromArgb(27, 94, 137), New Point(Width - 17, 10), New Point(Width - 9, 10), New Point(Width - 13, 7), G)
  718.  
  719.         G.DrawString(Value, Font, New SolidBrush(ForeColor), New Rectangle(5, 0, Width - 1, Height - 1), New StringFormat() With {.LineAlignment = StringAlignment.Center})
  720.  
  721.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  722.         G.Dispose() : B.Dispose()
  723.     End Sub
  724.  
  725. End Class
  726.  
  727. Public Class RecuperareIILabel : Inherits Label
  728.     Sub New()
  729.         MyBase.New()
  730.         Font = New Font("Verdana", 6.75F, FontStyle.Bold)
  731.         ForeColor = Color.FromArgb(27, 94, 137)
  732.     End Sub
  733. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement