Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.ComponentModel, System.Drawing.Drawing2D
- #Region "Helpers"
- ' Just the mouse states.
- Enum MouseState As Byte
- None = 0
- Over = 1
- Down = 2
- Block = 3
- End Enum
- ' The buttons
- Public Enum reCAPTCHAButtons
- Reload
- Audio
- Help
- End Enum
- ' Credits to ??? for the function.
- Module Draw
- Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
- Dim P As GraphicsPath = New GraphicsPath()
- Dim ArcRectangleWidth As Integer = Curve * 2
- P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
- P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
- P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
- P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
- P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
- Return P
- End Function
- End Module
- #End Region
- '------------------
- 'The reCAPTCHA Control
- 'Creator: FuckFace
- 'Version: 1.0
- 'Created: 31/01/2014
- 'Changed: 14/03/2014
- '------------------
- <DefaultEvent("ButtonClicked")> Public Class reCAPTCHAControl : Inherits Control
- ' !!! ---------------------------------------------------------------------
- ' !!! Change this if you want to another language like "Introduceți textul"
- Public TypeTheText As String = "Type the text"
- ' !!! Change this if you want to another language like "Introduceți textul"
- ' !!! ---------------------------------------------------------------------
- #Region "Declarations"
- ' The reCAPTCHA logo that is in the right bottom corner.
- Private reCAPTCHAImage As Image = Image.FromStream(New IO.MemoryStream(Convert.F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Lu6cBKJ1B42e0FuyNybBNaD5sBZSruS0uYd5EERF5eopAIIPVfCz/tpqr/ytAlzYrmtsfHFoqtYa4//V2gW4taqk2LKmiwCR9ogdQNcQBFTuVM+OXq60cdWGdU877yQBbvvokxt9BX7Is5Paed8GdimLxm5rVrIWwO1CxRIElDZMm9iDPZFKOGkuxfYJ+0prk9q1LmmyPX+ITVml+V8BLjomrUG7pVnS+nZpuNyN1mtPpnZdaxr4EHDrF635ygfLBYV8PasPFxiN+PBYvOGqv4Xw/A90twAwdIO25gAAAABJRU5ErkJggg==")))
- ' The reload captcha button.
- Private ReloadButtonImage As Image = Image.FromStream(New IO.MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAxUlEQVR42mNgwAPuVOf9xxSsKfj/dvfW/z9fvQDjz5fP///35w+qwicz+///+/cPjn++fP7/39+/YDaKSTDJxzP6/9+pzv//989vuCa4QpB1X+/e/H8lxuc/Lree87KsYAC559ni2f/xeerDicP/wQpvlWXiVHi/vRrsObDV+Ez7/ekjODQYriYFgxUi+/rNrs3/7zWX//985QKYD/IwXCdM0ddb1/9/uXkVrgkUdChWgAS/3bsND3CQdSgmwcDrbRvwuhUAWyrOPFQ2iiUAAAAASUVORK5CYII=")))
- ' The change-to-audio mode button.
- Private AudioButtonImage As Image = Image.FromStream(New IO.MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAYAAACALL/6AAAAN0lEQVR42mNgwAI+Xz7/n4FYAFL879+//yQpxqUBLA5TgI4xFBKjAStNVQ1YnUSypykKVmIiDgB0S7xT2mux1QAAAABJRU5ErkJggg==")))
- ' The help button.
- Private HelpButtonImage As Image = Image.FromStream(New IO.MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAm0lEQVR42mNggII7NQX/3+7e+v/nqxdgDGKDxBiQwZOZ/f///fuHFYPk4CbBBG8WpYIF79YX///98QNcHGwyyAoQ59WmVWBFz5fOgdMwhSA1DCD3gDhfblwBY2QNMIUgNXCFIAyyDmY1sjvBCmFWg/CP50//P1s0C0wjKwRbjeyZj6ePgU0E0cgK4cEECx6Q1SBFyD6GBw+xAQ4AZaAm1MYl0+4AAAAASUVORK5CYII=")))
- ' Booleans that change if the mouse is over them.
- Private OverReloadButton, OverAudioButton, OverHelpButton As Boolean
- ' Mouse state.
- Private State As MouseState = MouseState.None
- ' The Type the text textbox thinghy.
- Private WithEvents TextBox As Windows.Forms.TextBox
- ' The event that handles clicks on the reload/audio/help button.
- Public Event ButtonClicked(ByVal ClickedButton As reCAPTCHAButtons)
- #End Region
- #Region "Properties"
- ' Property helpers.
- Private _MaxLength As Integer = 32767
- Private _ReadOnly As Boolean = True
- Private _Text As String = TypeTheText
- Private _Image As Image
- Private _DrawreCAPTCHALogo As Boolean = True
- Private _DrawReloadButton As Boolean = True
- Private _DrawAudioButton As Boolean = True
- Private _DrawHelpButton As Boolean = True
- ' Just the MaxLength property for the textbox.
- <Category("Behaivor")> _
- Property MaxLength As Integer
- Get
- Return _MaxLength
- End Get
- Set(ByVal value As Integer)
- _MaxLength = value
- If TextBox IsNot Nothing Then
- TextBox.MaxLength = value
- End If
- End Set
- End Property
- ' If this property is set to true then the textbox will be disabled.
- <Category("Behaivor")> _
- Property [ReadOnly] As Boolean
- Get
- Return Not (_ReadOnly)
- End Get
- Set(ByVal value As Boolean)
- _ReadOnly = Not (value)
- If TextBox IsNot Nothing Then
- TextBox.ReadOnly = value
- End If
- End Set
- End Property
- ' This property is the input from the user.
- Public Overrides Property Text As String
- Get
- Return _Text
- End Get
- Set(ByVal value As String)
- _Text = value
- End Set
- End Property
- ' This property lets you use an image for the captcha.
- <Category("Appearance")> _
- Public Property Image As Image
- Get
- Return _Image
- End Get
- Set(ByVal value As Image)
- _Image = value
- Invalidate()
- End Set
- End Property
- ' The following properties let you choose if you want some stuff to be drawn.
- <Category("Drawing")> _
- Public Property DrawreCAPTCHALogo As Boolean
- Get
- Return _DrawreCAPTCHALogo
- End Get
- Set(ByVal value As Boolean)
- _DrawreCAPTCHALogo = value
- Invalidate()
- End Set
- End Property
- <Category("Drawing")> _
- Public Property DrawReloadButton As Boolean
- Get
- Return _DrawReloadButton
- End Get
- Set(ByVal value As Boolean)
- _DrawReloadButton = value
- Invalidate()
- End Set
- End Property
- <Category("Drawing")> _
- Public Property DrawAudioButton As Boolean
- Get
- Return _DrawAudioButton
- End Get
- Set(ByVal value As Boolean)
- _DrawAudioButton = value
- Invalidate()
- End Set
- End Property
- <Category("Drawing")> _
- Public Property DrawHelpButton As Boolean
- Get
- Return _DrawHelpButton
- End Get
- Set(ByVal value As Boolean)
- _DrawHelpButton = value
- Invalidate()
- End Set
- End Property
- Private Sub TextBox_OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs) Handles TextBox.TextChanged
- Text = TextBox.Text
- ' Hard-coded the Type The Text thinghy.
- If TextBox.Text = Nothing Then
- TextBox.Text = TypeTheText
- TextBox.ForeColor = Color.FromArgb(135, 119, 127)
- ElseIf Not TextBox.Text = TypeTheText Then
- TextBox.Select(TextBox.Text.Length, 0)
- TextBox.Text = TextBox.Text.Replace(TypeTheText, Nothing)
- TextBox.ForeColor = Color.FromKnownColor(KnownColor.ControlText)
- End If
- End Sub
- Private Sub TextBox_Enter(ByVal s As Object, ByVal e As EventArgs) Handles TextBox.Enter
- ' Hard-coded the Type The Text thinghy.
- If TextBox.Text = Nothing Or TextBox.Text = TypeTheText Then
- TextBox.Select(0, 0)
- End If
- End Sub
- Private Sub TextBox_OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs) Handles TextBox.KeyDown
- ' If the user presses CTRL + A, select all the text in the textbox.
- If e.Control AndAlso e.KeyCode = Keys.A Then
- TextBox.SelectAll()
- e.SuppressKeyPress = True
- End If
- ' If the user presses CTRL + C, copy all the text in the textbox.
- If e.Control AndAlso e.KeyCode = Keys.C Then
- TextBox.Copy()
- e.SuppressKeyPress = True
- End If
- End Sub
- Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
- MyBase.OnMouseMove(e)
- ' Check if the mouse is over the rounded rectangle that surrounds the buttons.
- If e.X > 188 AndAlso e.X < 212 AndAlso e.Y > 72 AndAlso e.Y < 122 Then
- ' TO DO: MAKE THIS FAST-DONE SH*T SHORTER AND COMMENT IT BETTER.
- ' MouseOver handling for the reload button only.
- If _DrawReloadButton AndAlso _DrawAudioButton AndAlso _DrawHelpButton Then
- If e.Y <= 89 Then
- OverReloadButton = True
- Cursor = Cursors.Hand
- Else
- OverReloadButton = False
- Cursor = Cursors.Default
- End If
- If e.Y > 89 AndAlso e.Y <= 105 Then
- OverAudioButton = True
- Cursor = Cursors.Hand
- Else
- OverAudioButton = False
- End If
- If e.Y > 105 Then
- OverHelpButton = True
- Cursor = Cursors.Hand
- End If
- ElseIf _DrawReloadButton AndAlso Not _DrawAudioButton AndAlso Not _DrawHelpButton Then
- If e.Y >= 89 AndAlso e.Y <= 105 Then
- OverReloadButton = True
- Cursor = Cursors.Hand
- Else
- OverReloadButton = False
- Cursor = Cursors.Default
- End If
- ' MouseOver handling for the reload button and the audio button.
- ElseIf _DrawReloadButton AndAlso _DrawAudioButton AndAlso Not _DrawHelpButton Then
- If e.Y <= 89 Then
- OverReloadButton = True
- Cursor = Cursors.Hand
- Else
- OverReloadButton = False
- Cursor = Cursors.Default
- End If
- If e.Y > 89 AndAlso e.Y <= 105 Then
- OverAudioButton = True
- Cursor = Cursors.Hand
- Else
- OverAudioButton = False
- End If
- ' MouseOver handling for the reload button and the help button.
- ElseIf _DrawReloadButton AndAlso Not _DrawAudioButton AndAlso _DrawHelpButton Then
- If e.Y <= 89 Then
- OverReloadButton = True
- Cursor = Cursors.Hand
- Else
- OverReloadButton = False
- Cursor = Cursors.Default
- End If
- If e.Y > 89 AndAlso e.Y <= 105 Then
- OverHelpButton = True
- Cursor = Cursors.Hand
- Else
- OverHelpButton = False
- End If
- ' MouseOver handling for the audio button only.
- ElseIf Not _DrawReloadButton AndAlso _DrawAudioButton AndAlso Not _DrawHelpButton Then
- If e.Y >= 89 AndAlso e.Y <= 105 Then
- OverAudioButton = True
- Cursor = Cursors.Hand
- Else
- OverAudioButton = False
- Cursor = Cursors.Default
- End If
- ' MouseOver handling for the audio button and the help button.
- ElseIf Not _DrawReloadButton AndAlso _DrawAudioButton AndAlso _DrawHelpButton Then
- If e.Y <= 89 Then
- OverAudioButton = True
- Cursor = Cursors.Hand
- Else
- OverAudioButton = False
- Cursor = Cursors.Default
- End If
- If e.Y > 89 AndAlso e.Y <= 105 Then
- OverHelpButton = True
- Cursor = Cursors.Hand
- Else
- OverHelpButton = False
- End If
- ' MouseOver handling for the help button only.
- ElseIf Not _DrawReloadButton AndAlso Not _DrawAudioButton AndAlso _DrawHelpButton Then
- If e.Y >= 89 AndAlso e.Y <= 105 Then
- OverHelpButton = True
- Cursor = Cursors.Hand
- Else
- OverHelpButton = False
- Cursor = Cursors.Default
- End If
- End If
- Else
- ' If the mouse is not over the rounded rectangle that surrounds the buttons, set all of them to False.
- OverReloadButton = False
- OverAudioButton = False
- OverHelpButton = False
- ' Set the cursor back to Default.
- Cursor = Cursors.Default
- End If
- End Sub
- Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
- MyBase.OnMouseDown(e)
- ' Set the State to Down.
- State = MouseState.Down : Invalidate()
- ' Raise the ButtonClicked event if the mouse is over one button.
- If OverReloadButton Then
- RaiseEvent ButtonClicked(reCAPTCHAButtons.Reload)
- ElseIf OverAudioButton Then
- RaiseEvent ButtonClicked(reCAPTCHAButtons.Audio)
- ElseIf OverHelpButton Then
- RaiseEvent ButtonClicked(reCAPTCHAButtons.Help)
- End If
- End Sub
- Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
- MyBase.OnMouseUp(e)
- ' Set the State to Over and focus the TextBox.
- State = MouseState.Over : TextBox.Focus() : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
- MyBase.OnMouseEnter(e)
- ' Set the State to Over.
- State = MouseState.Over : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
- MyBase.OnMouseLeave(e)
- ' Set the State to None.
- State = MouseState.None : Invalidate()
- End Sub
- Protected Overrides Sub OnResize(ByVal e As EventArgs)
- MyBase.OnResize(e)
- ' Just to not let the user resize this.
- Size = New Size(320, 130)
- End Sub
- Protected Overrides Sub OnCreateControl()
- MyBase.OnCreateControl()
- ' If the TextBox is not there, add it.
- If Not Controls.Contains(TextBox) Then
- Controls.Add(TextBox)
- Text = TypeTheText
- End If
- ' This will be the ForeColor of the TextBox.
- ForeColor = Color.FromArgb(135, 119, 127)
- End Sub
- #End Region
- Sub New()
- ' Set some settings of the control. See more info about SetStyle here:
- ' http://msdn.microsoft.com/en-us/library/system.windows.forms.controlstyles(v=vs.110).aspx
- SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer _
- Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
- DoubleBuffered = True
- ' Set some settings of the TextBox.
- TextBox = New Windows.Forms.TextBox
- With TextBox
- .BackColor = Color.White
- .BorderStyle = BorderStyle.None
- .Cursor = Cursors.IBeam
- .Enabled = _ReadOnly
- .Font = New Font("Arial", 10)
- .ForeColor = Color.FromArgb(51, 51, 51)
- .Height = 17
- .Location = New Point(18, 84)
- .MaxLength = _MaxLength
- .Text = Text
- .Width = 152
- End With
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- MyBase.OnPaint(e)
- Dim Curve As Integer = 4 ' TO DO: Find the right curve.
- With e.Graphics
- .Clear(Parent.BackColor)
- .SmoothingMode = SmoothingMode.HighQuality
- .CompositingQuality = CompositingQuality.HighQuality
- If TextBox.Text = TypeTheText Then TextBox.ForeColor = ForeColor
- ' Draw the background.
- .FillPath(Brushes.White, RoundRect(New Rectangle(0, 0, 319, 129), Curve))
- ' Draw the red gradient.
- .FillPath(New LinearGradientBrush(New Rectangle(3, 3, 313, 123), Color.FromArgb(175, 21, 0) _
- , Color.FromArgb(124, 0, 0), 90S) _
- , RoundRect(New Rectangle(3, 3, 313, 123), Curve))
- ' Draw the reCAPTCHA logo.
- If _DrawreCAPTCHALogo Then .DrawImage(reCAPTCHAImage, 218, 77)
- ' Draw the rounded rectangle that surrounds the image.
- .FillPath(Brushes.White, RoundRect(New Rectangle(9, 9, 302, 59), Curve))
- .DrawPath(Pens.White, RoundRect(New Rectangle(9, 9, 302, 59), Curve))
- ' TO DO: FIND THE RIGHT SPOT WHERE TO PLACE THE IMAGE.
- ' Draw the image/NO IMAGE! text.
- If _Image IsNot Nothing Then
- .DrawImage(_Image, 11, 11, 300, 57)
- Else
- .DrawString("NO IMAGE!", New Font("Arial", 32, FontStyle.Bold), Brushes.Red, 38, 15)
- End If
- ' Draw the rounded rectangle that surrounds the textbox.
- .FillPath(New SolidBrush(Color.FromArgb(255, 220, 115)), RoundRect(New Rectangle(9, 72, 173, 49), Curve))
- ' Draw the contour of the textbox.
- .FillRectangle(New SolidBrush(Color.FromArgb(204, 169, 64)), New Rectangle(17, 83, 153, 17))
- ' TO DO: MAKE THIS FAST-DONE SH*T SHORTER.
- '--------------------- Drawing the buttons.
- ' Draw all the buttons
- If _DrawReloadButton AndAlso _DrawAudioButton AndAlso _DrawHelpButton Then
- ' Draw the rounded rectangle that surrounds the buttons.
- .DrawPath(New Pen(Color.FromArgb(74, 0, 0)), RoundRect(New Rectangle(188, 72, 25, 50), Curve))
- .FillPath(New SolidBrush(Color.FromArgb(202, 52, 33)), RoundRect(New Rectangle(189, 73, 23, 48), Curve))
- ' Draw the lines between the buttons.
- .DrawLine(New Pen(Color.FromArgb(141, 36, 23)), 189, 89, 212, 89)
- .DrawLine(New Pen(Color.FromArgb(141, 36, 23)), 189, 105, 212, 105)
- ' Draw the buttons themselves.
- .DrawImage(ReloadButtonImage, 197, 75, 10, 12)
- .DrawImage(AudioButtonImage, 197, 93, 12, 10)
- .DrawImage(HelpButtonImage, 197, 109, 10, 10)
- ' Draw only the reload button.
- ElseIf _DrawReloadButton AndAlso Not _DrawAudioButton AndAlso Not _DrawHelpButton Then
- ' Draw the rounded rectangle that surrounds the button.
- .DrawPath(New Pen(Color.FromArgb(74, 0, 0)), RoundRect(New Rectangle(188, 89, 25, 18), Curve))
- .FillPath(New SolidBrush(Color.FromArgb(202, 52, 33)), RoundRect(New Rectangle(189, 90, 23, 16), Curve))
- ' Draw the button itself.
- .DrawImage(ReloadButtonImage, 197, 93, 10, 12)
- ' Draw the reload button and the audio button.
- ElseIf _DrawReloadButton AndAlso _DrawAudioButton AndAlso Not _DrawHelpButton Then
- ' Draw the rounded rectangle that surrounds the buttons.
- .DrawPath(New Pen(Color.FromArgb(74, 0, 0)), RoundRect(New Rectangle(188, 72, 25, 35), Curve))
- .FillPath(New SolidBrush(Color.FromArgb(202, 52, 33)), RoundRect(New Rectangle(189, 73, 23, 33), Curve))
- ' Draw the lines between the buttons.
- .DrawLine(New Pen(Color.FromArgb(141, 36, 23)), 189, 89, 212, 89)
- ' Draw the buttons themselves.
- .DrawImage(ReloadButtonImage, 197, 75, 10, 12)
- .DrawImage(AudioButtonImage, 197, 93, 12, 10)
- ' Draw the reload button and the help button.
- ElseIf _DrawReloadButton AndAlso Not _DrawAudioButton AndAlso _DrawHelpButton Then
- ' Draw the rounded rectangle that surrounds the buttons.
- .DrawPath(New Pen(Color.FromArgb(74, 0, 0)), RoundRect(New Rectangle(188, 72, 25, 35), Curve))
- .FillPath(New SolidBrush(Color.FromArgb(202, 52, 33)), RoundRect(New Rectangle(189, 73, 23, 33), Curve))
- ' Draw the lines between the buttons.
- .DrawLine(New Pen(Color.FromArgb(141, 36, 23)), 189, 89, 212, 89)
- ' Draw the buttons themselves.
- .DrawImage(ReloadButtonImage, 197, 75, 10, 12)
- .DrawImage(HelpButtonImage, 197, 93, 10, 10)
- ' Draw only the audio button.
- ElseIf Not _DrawReloadButton AndAlso _DrawAudioButton AndAlso Not _DrawHelpButton Then
- ' Draw the rounded rectangle that surrounds the button.
- .DrawPath(New Pen(Color.FromArgb(74, 0, 0)), RoundRect(New Rectangle(188, 89, 25, 18), Curve))
- .FillPath(New SolidBrush(Color.FromArgb(202, 52, 33)), RoundRect(New Rectangle(189, 90, 23, 16), Curve))
- ' Draw the button itself.
- .DrawImage(AudioButtonImage, 197, 93, 12, 10)
- ' Draw the audio button and the help button
- ElseIf Not _DrawReloadButton AndAlso _DrawAudioButton AndAlso _DrawHelpButton Then
- ' Draw the rounded rectangle that surrounds the buttons.
- .DrawPath(New Pen(Color.FromArgb(74, 0, 0)), RoundRect(New Rectangle(188, 72, 25, 35), Curve))
- .FillPath(New SolidBrush(Color.FromArgb(202, 52, 33)), RoundRect(New Rectangle(189, 73, 23, 33), Curve))
- ' Draw the lines between the buttons.
- .DrawLine(New Pen(Color.FromArgb(141, 36, 23)), 189, 89, 212, 89)
- ' Draw the buttons themselves.
- .DrawImage(AudioButtonImage, 197, 75, 12, 10)
- .DrawImage(HelpButtonImage, 197, 93, 10, 10)
- ' Draw only the help button.
- ElseIf Not _DrawReloadButton AndAlso Not _DrawAudioButton AndAlso _DrawHelpButton Then
- .DrawPath(New Pen(Color.FromArgb(74, 0, 0)), RoundRect(New Rectangle(188, 89, 25, 18), Curve))
- .FillPath(New SolidBrush(Color.FromArgb(202, 52, 33)), RoundRect(New Rectangle(189, 90, 23, 16), Curve))
- ' Draw the button itself.
- .DrawImage(HelpButtonImage, 197, 93, 10, 10)
- End If
- End With
- End Sub
- End Class
Add Comment
Please, Sign In to add comment