Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, x As Single, y-As Single) If Button< >1 Then Exit Sub Picture1.Left=Picture1.Left X ‘Move Picture Text1.Width=Picture1.Left-Text1.Left ’Change TextBox’s size End Sub
Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint _As POINTAPI) As Long Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Type POINTAPI x As Long y As Long End Type
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, - y As Single) Dim Pnt As POINTAPI Dim CurX As Long Dim CurY As Long Dim DistX As Long Dim DistY As Long
Const mDist = 150 ’150 twips
GetCursorPos Pnt ’Get mouse position ScreenToClient Me.hwnd, Pnt ’Convert to client coordinate CurX = Pnt.x * Screen.TwipsPerPixelX ’Pixels to Twips CurY = Pnt.y * Screen.TwipsPerPixelY DistX = Abs(CurX - (Text1.Left Text1.Width)) ’distance to text1’s DistY = Abs(CurY - (Text1.Top Text1.Height))
If DistX < = mDist And DistY < = mDist Then ’set mouse pointer ’according to distance Form1.MousePointer = vbSizeNWSE ElseIf DistX < = mDist And DistY > mDist Then Form1.MousePointer = vbSizeWE ElseIf DistX > mDist And DistY < = mDist Then Form1.MousePointer = vbSizeNS Else Form1.MousePointer = vbDefault End If
If Button < > 1 Then Exit Sub If Form1.MousePointer = vbSizeNWSE Then ’change text1’ size Text1.Width = CurX - Text1.Left