[Resolved by krtxmrtz] MouseMove over right hand edge of textbox.
Hi,
I've an annoyance that perhaps you can help with ?
I want to know when the mouse is over the right hand edge of a control (nominally a text box). The left and width are pixels while value is in TWIPS (or vice-versa). Anyone got a suggestion ? I need to use the mousemove to change the mousepointer and to enable the user to stretch the textbox.
Thanks in advance.
Chubby..
Re: MouseMove over right hand edge of textbox.
Quote:
Originally Posted by Chubby
Hi,
I've an annoyance that perhaps you can help with ?
I want to know when the mouse is over the right hand edge of a control (nominally a text box). The left and width are pixels while value is in TWIPS (or vice-versa). Anyone got a suggestion ? I need to use the mousemove to change the mousepointer and to enable the user to stretch the textbox.
Thanks in advance.
Chubby..
I have found this code for manually resizing it horizontally (place a textbox named Text1 in a form):
VB Code:
Dim EnableResizing As Boolean
Dim Tp As Single
Private Sub Form_Load()
EnableResizing = False
Tp = Text1.Top
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MousePointer = 9 Then
EnableResizing = True
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Y < Tp + Text1.Height And Y > Tp And (Abs(X - Text1.Left) < 120 Or Abs(X - Text1.Left - Text1.Width) < 120) Then
MousePointer = 9
Else
MousePointer = 0
End If
If EnableResizing Then
If Abs(X - Text1.Left) < 120 Then
Text1.Move X, Tp, Text1.Width - X + Text1.Left, Text1.Height
ElseIf Abs(X - Text1.Left - Text1.Width) < 120 Then
Text1.Move Text1.Left, Tp, X - Text1.Left, Text1.Height
End If
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
EnableResizing = False
End Sub
Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Y < Text1.Height And Y > 0 And (X < 120 Or Text1.Width - X < 120) Then
MousePointer = 9
Else
MousePointer = 0
End If
End Sub
Re: MouseMove over right hand edge of textbox.
krtxmrtz,
Your time and effort is most appreciated. The code you posted up, found or-not works a treat and is exactly what I'm looking for.
Thanks very much.
Chubby.. :thumb:
Re: MouseMove over right hand edge of textbox.
Quote:
Originally Posted by Chubby
krtxmrtz,
Your time and effort is most appreciated. The code you posted up, found or-not works a treat and is exactly what I'm looking for.
Thanks very much.
Chubby.. :thumb:
You're most welcome.
Fortunately I had already worked on this some time ago and all I had to do was pull it back from my data bank.