29/01/10 22:16
Alfonso
Option Strict On Option Explicit On Imports System.Runtime.InteropServices Public Class Form1 Inherits System.Windows.Forms.Form <DllImport("user32.dll")> _ Private Shared Function CreateCaret(ByVal hWnd As Integer, ByVal hBitmap As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer End Function <DllImport("user32.dll")> _ Private Shared Function GetFocus() As Integer End Function <DllImport("user32.dll")> _ Private Shared Function ShowCaret(ByVal hWnd As Integer) As Integer End Function Private Sub ShowCustomCaret(ByVal w As Short, ByVal h As Short) CreateCaret(GetFocus(), 0, w, h) ShowCaret(GetFocus()) End Sub Private Sub Text1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus ShowCustomCaret(5, 14) ' caret largo 5 alto 14 End Sub End Class
Però:
Se sei "un tantino inesperto" perchè non ti accontenti del caret standard del controllo textbox ?
aaa