24h購物| | PChome| 登入
2007-12-12 09:17:05| 人氣131| 回應1 | 上一篇 | 下一篇

程(use on the computer taxt)

推薦 0 收藏 0 轉貼0 訂閱站台

Dim sp As Integer
Dim d As Integer ’0:上 1:下 2:左 3:右

Private Sub Command1_Click()
Label1.Left = Label1.Left - sp
If Label1.Left <= 0 Then Label1.Left = Form1.Width
End Sub

Private Sub Command2_Click()
Label1.Left = Label1.Left + sp
If Label1.Left >= Form1.Width Then Label1.Left = 0
End Sub

Private Sub Command3_Click()
Label1.Top = Label1.Top - sp
If Label1.Top <= 0 Then Label1.Top = Form1.Height
End Sub

Private Sub Command4_Click()
Label1.Top = Label1.Top + sp
If Label1.Top >= Form1.Height Then Label1.Top = 0
End Sub

Private Sub Command5_Click() ’上
d = 0
End Sub

Private Sub Command6_Click() ’左
d = 2
End Sub

Private Sub Command7_Click() ’右
d = 3
End Sub

Private Sub Command8_Click() ’下
d = 1
End Sub

Private Sub Command9_Click()
If Timer1.Enabled = True Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 38
Label1.Top = Label1.Top - sp ’上
If Label1.Top <= 0 Then Label1.Top = Form1.Height
Case 40
Label1.Top = Label1.Top + sp ’下
If Label1.Top >= Form1.Height Then Label1.Top = 0
Case 37
Label1.Left = Label1.Left - sp ’左
If Label1.Left <= 0 Then Label1.Left = Form1.Width
Case 39
Label1.Left = Label1.Left + sp ’右
If Label1.Left >= Form1.Width Then Label1.Left = 0
End Select
End Sub

Private Sub Form_Load()
sp = 200
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
End Sub

Private Sub Timer1_Timer()
Select Case KeyCode
Case 38
Label1.Top = Label1.Top - sp ’上
If Label1.Top <= 0 Then Label1.Top = Form1.Height
Case 40
Label1.Top = Label1.Top + sp ’下
If Label1.Top >= Form1.Height Then Label1.Top = 0
Case 37
Label1.Left = Label1.Left - sp ’左
If Label1.Left <= 0 Then Label1.Left = Form1.Width
Case 39
Label1.Left = Label1.Left + sp ’右
If Label1.Left >= Form1.Width Then Label1.Left = 0
End Select
End Sub

台長: 子坊嵐櫻
人氣(131) | 回應(1)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 不分類 | 個人分類: 嵐的保衛地球日記 |
此分類下一篇:寒假阿阿阿
此分類上一篇:點**

星☆°
噢* 這不是VB嗎 = =?

原來嵐嵐學校正在學丫 ∪﹏∪

覺得還OK嗎?

要加油加油唷~♡
2007-12-12 14:57:52
是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入圖片中算式的結果(可能為0) 
(有*為必填)
TOP
詳全文