文件名称:vb移动图像代码
-
所属分类:
- 标签属性:
- 上传时间:2011-08-31
-
文件大小:1.61kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
Dim x_step As Integer '声明
Dim y_step As Integer
Dim 往左 As Integer
Dim 往右 As Integer
Dim 往上 As Integer
Dim 往下 As Integer
Dim 重复次数_step As Integer
Private Sub Form_KeyDown(keycode As Integer, shift As Integer) '窗体接收按下任意键
'Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
'MsgBox keycode
If keycode = 37 Then
往左 = 1
End If
If keycode = 38 Then
往上 = 1
End If
If keycode = 39 Then
往右 = 1
End If
If keycode = 40 Then
往下 = 1
End If
Timer2.Enabled = True
End Sub
Private Sub Picture1_KeyUp(keycode As Integer, shift As Integer) '窗体接收放开任意键
Timer2.Enabled = False
往左 = 0
往右 = 0
往上 = 0
往下 = 0
End Sub
Private Sub Timer2_Timer()
If 往左 = 1 Then
If Line1.X1 - 100 <= 0 Then
Line1.X1 = 0
Line1.X2 = 2000
Else
Line1.X1 = Line1.X1 - 100
Line1.X2 = Line1.X2 - 100
End If
End If
If 往右 = 1 Then
If Line1.X2 + 100 > Picture1.Width Then
Line1.X1 = Picture1.Width - 2000
Line1.X2 = Picture1.Width
Else
Line1.X2 = Line1.X2 + 100
Line1.X1 = Line1.X2 - 2000
End If
End If
If 往上 = 1 And Line1.Y1 > 1000 Then
Line1.Y1 = Line1.Y1 - 100
Line1.Y2 = Line1.Y1
End If
If 往下 = 1 And Line1.Y1 < Picture1.Height - 1000 Then
Line1.Y1 = Line1.Y1 + 100
Line1.Y2 = Line1.Y1
End If
End Sub
Dim y_step As Integer
Dim 往左 As Integer
Dim 往右 As Integer
Dim 往上 As Integer
Dim 往下 As Integer
Dim 重复次数_step As Integer
Private Sub Form_KeyDown(keycode As Integer, shift As Integer) '窗体接收按下任意键
'Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
'MsgBox keycode
If keycode = 37 Then
往左 = 1
End If
If keycode = 38 Then
往上 = 1
End If
If keycode = 39 Then
往右 = 1
End If
If keycode = 40 Then
往下 = 1
End If
Timer2.Enabled = True
End Sub
Private Sub Picture1_KeyUp(keycode As Integer, shift As Integer) '窗体接收放开任意键
Timer2.Enabled = False
往左 = 0
往右 = 0
往上 = 0
往下 = 0
End Sub
Private Sub Timer2_Timer()
If 往左 = 1 Then
If Line1.X1 - 100 <= 0 Then
Line1.X1 = 0
Line1.X2 = 2000
Else
Line1.X1 = Line1.X1 - 100
Line1.X2 = Line1.X2 - 100
End If
End If
If 往右 = 1 Then
If Line1.X2 + 100 > Picture1.Width Then
Line1.X1 = Picture1.Width - 2000
Line1.X2 = Picture1.Width
Else
Line1.X2 = Line1.X2 + 100
Line1.X1 = Line1.X2 - 2000
End If
End If
If 往上 = 1 And Line1.Y1 > 1000 Then
Line1.Y1 = Line1.Y1 - 100
Line1.Y2 = Line1.Y1
End If
If 往下 = 1 And Line1.Y1 < Picture1.Height - 1000 Then
Line1.Y1 = Line1.Y1 + 100
Line1.Y2 = Line1.Y1
End If
End Sub
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : 新建 文本文档.txt 列表
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.