Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class MyTB : Inherits TextBox
- <DllImport("user32.dll", SetLastError:=True)> _
- Private Shared Function CreateCaret(ByVal hWnd As IntPtr, ByVal hBitmap As IntPtr, ByVal nWidth As Integer, ByVal nHeight As Integer) As Boolean
- End Function
- <DllImport("user32.dll")>
- Private Shared Function DestroyCaret() As Boolean
- End Function
- <DllImport("user32.dll")>
- Private Shared Function SetCaretBlinkTime(ByVal uMSeconds As UInt32) As Boolean
- End Function
- <DllImport("user32.dll")> _
- Private Shared Function ShowCaret(ByVal hWnd As IntPtr) As Boolean
- End Function
- Protected Overrides Sub OnGotFocus(e As EventArgs)
- MyBase.OnGotFocus(e)
- MyTB.CreateCaret(Me.Handle, Nothing, 5, Me.Font.Height)
- MyTB.SetCaretBlinkTime(500UI)
- MyTB.ShowCaret(Me.Handle)
- End Sub
- Protected Overrides Sub OnLostFocus(e As EventArgs)
- MyBase.OnLostFocus(e)
- MyTB.DestroyCaret()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement