回覆列表
-
1 # 變餅檔
-
2 # 薛門1
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)If KeyCode = Asc("F") Then Shape1.Shape = 1If KeyCode = Asc("J") Then Shape1.Shape = 0If KeyCode = Asc("Y") Then Shape1.Shape = 3If KeyCode = Asc("T") Then Shape1.Shape = 2If KeyCode = Asc("H") Then Shape1.BackColor = vbRedIf KeyCode = Asc("L") Then Shape1.BackColor = vbBlueIf KeyCode = Asc("C") Then Shape1.BackColor = &H80FF&End SubPrivate Sub Form_Load()Me.KeyPreview = TrueShape1.BackStyle = 1End Sub
複製如下程式碼到程式碼區:
Private Sub Command1_Click()
Text1.SetFocus
sendKeyN " ", 3
End Sub
Private Sub sendKeyN(s As String, n As Integer)
While n <> 0
SendKeys s
n = n - 1
Wend
End Sub