Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Command1.Caption = "打开" End Sub'自己不会看看?以为简单就不用负分吗?
楼上写的太简单,是错的======================================== Option Explicit Private Declare Function ReleaseCapture Lib "user32" () As Long Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As LongPrivate Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If (X < 0) Or (Y < 0) Or (X > Command1.Width) Or (Y > Command1.Height) Then ReleaseCapture Command1.Caption = "" Else SetCapture Command1.hwnd Command1.Caption = "打开" End If End Sub
楼上稍显复杂,其实可以更简单,只需两个mousemove就可实现: Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Command1.Caption = "打开" End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Command1.Caption = " " End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Caption = "打开"
End Sub'自己不会看看?以为简单就不用负分吗?
Option Explicit
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As LongPrivate Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X < 0) Or (Y < 0) Or (X > Command1.Width) Or (Y > Command1.Height) Then
ReleaseCapture
Command1.Caption = ""
Else
SetCapture Command1.hwnd
Command1.Caption = "打开"
End If
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Caption = "打开"
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Caption = " "
End Sub