无知
Option Explicit Dim X_Source As Integer, Y_Source As Integer Dim CodeString() As String, iCount As Long Private Sub Form_Initialize() iCount = 0: ReDim CodeString(iCount) End Sub Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) ReDim Preserve CodeString(iCount) If Button = 1 Then CodeString(iCount) = "Mouse Button1" & vbCrLf ElseIf Button = 2 Then CodeString(iCount) = "Mouse Button2" & vbCrLf ElseIf Button = 4 Then CodeString(iCount) = "Mouse Button4" & vbCrLf Else CodeString(iCount) = "Mouse Error" & vbCrLf End If iCount = iCount + 1 Call ShowTextBoxInfo End Sub Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ReDim Preserve CodeString(iCount) If X_Source = 0 And Y_Source = 0 Then X_Source = X: Y_Source = Y Else If X_Source <> X Or Y_Source <> Y Then CodeString(iCount) = "Mouse Moving" & vbCrLf End If End If iCount = iCount + 1 Call ShowTextBoxInfo End Sub Private Sub ShowTextBoxInfo() Dim i As Long txtCommon.Text = "" ReDim Preserve CodeString(iCount) For i = iCount To 0 Step -1 If CodeString(i) <> "" Then txtCommon.Text = txtCommon.Text & CodeString(i) End If Next i End Sub
Public Sub TEXTADD(OBJ As TextBox, TT As String) If Len(OBJ.Text) = 0 Then OBJ.Text = TT '避免出现一个空行 Else OBJ.Text = OBJ.Text & vbCrLf & TT '换行,再增加内容 End If End Sub Private Sub Command1_Click() Call TEXTADD(Text1, Time) '调用,二个参数,1为显示的控件名,2为 内容 End Sub
Public Sub LOGADD(TT As String) If List1.ListCount > 20 Then '最大记录数 ,根据你的需要来设置。 List1.RemoveItem 0 End If List1.AddItem Time & ":" & TT '显示时间及内容 End Sub Private Sub Command1_Click() Call LOGADD("asdag") End Sub