Resumen Cambiar el selstart segun la pos. del mouse

At 18:02 15/10/97 -0300, you wrote:
>que pretendo hacer es que cuando pase el mouse por encima del text
>(haciendo un drag) me cambie la posición del cursor, así cuando suelte el
>mouse pueda insertar el texto en la posición del mouse. ¿se entiende?

En mi mensaje anterior no me había dado de cuenta de que se trataba de darg and drop.

- Inserta el PictureBox con el mismo tipo y tamaño de letra que el textbox (para poder tratar fuentes proporcionales)

- En el DragOver :

Sub Text1_DragOver (source As Control, X As Single, Y As Single, State As Integer)
Dim ancho As Single, i As Integer, j As Integer, aux As String

aux = text1 + " "
j = Len(aux)
For i = 1 To j
    ancho = picture1.TextWidth(Left(aux, i))
    If ancho > X Then
        text1.SelStart = i - 1
        Exit For
    End If
Next i
End Sub

 -Y en el DragDrop algo como esto :

Sub Text1_DragDrop (source As Control, X As Single, Y As Single)
text1 = Left$(text1, text1.SelStart) + source.Text + Right$(text1, Len(text1) - text1.SelStart)
End Sub

Un saludo.



Resumen Resumen

Visual Basic Página de Visual Basic

Página principal Página principal

www.jrubi.com