求VB作品一个_vb设计程序求s=1+(1+2)+(1+2+3)...
以下是我自己做的一个小游戏,不知道算不算一个程序。只用了一个窗体,一个image,一个picture
代码如下:
Option Explicit
Dim t, su, f, h, s, r, un As Integer
Private Sub Form_Activate()
Picture2.SetFocus
End Sub
Private Sub Form_Load()
Form1.Caption = "撞球游戏"
Form1.Top = Screen.Height / 2 - Form1.Height / 2
Form1.Left = Screen.Width / 2 - Form1.Width / 2
Timer1.Enabled = True
Timer1.Interval = 1000
t = 3
Timer2.Enabled = False
Timer3.Enabled = False
Timer2.Interval = 1
Timer3.Interval = 1
Label1.Caption = ""
Label1.Caption = t
su = HScroll1.Value
f = su
h = su
s = su
End Sub
Private Sub HScroll1_Change()
su = HScroll1.Value
Picture2.SetFocus
Timer1.Enabled = True
Timer2.Enabled = False
Timer3.Enabled = False
Picture1.Top = 0
Label1.Caption = t
f = su
h = su
s = su
End Sub
Private Sub Picture2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then
Picture2.Left = Picture2.Left - su
f = -su
Else
If KeyCode = 39 Then
Picture2.Left = Picture2.Left + su
f = su
End If
End If
If Picture2.Left <= 0 Then
Picture2.Left = 0
Else
If Picture2.Left >= Form1.Width - Picture2.Width Then
Picture2.Left = Form1.Width - Picture2.Width
End If
End If
End Sub
Private Sub Timer1_Timer()
t = t - 1
Label1.Caption = t
If t = 0 Then
Timer1.Enabled = False
t = 3
Timer2.Enabled = True
Timer3.Enabled = True
Label1.Caption = ""
End If
End Sub
Private Sub Timer2_Timer()
Picture2.Left = Picture2.Left + f
If Picture2.Left <= 0 Then
f = su
Else
If Picture2.Left >= Form1.Width - Picture2.Width Then
f = -su
End If
End If
End Sub
Private Sub Timer3_Timer()
Picture1.Move Picture1.Left + h, Picture1.Top + s
If Picture1.Left <= 0 Then
h = su
Else
If Picture1.Left >= Form1.Width - Picture1.Width Then
h = -su
End If
End If
If Picture1.Top = 0 Then
s = su
Else
If Picture1.Top >= Form1.Height - Picture1.Height Then
r = MsgBox("你输了,是否重来?", vbYesNo, "撞球游戏")
un = 0
If r = 6 Then
su = HScroll1.Value
Picture2.SetFocus
Timer1.Enabled = True
Timer2.Enabled = False
Timer3.Enabled = False
Picture1.Top = 0
Label1.Caption = t
f = su
h = su
s = su
Else
If r = 7 Then
End
End If
End If
End If
End If
'以下为浮木撞到球时发生的动作
If Picture1.Left + Picture1.Width / 2 >= Picture2.Left Then
If Picture1.Left + Picture1.Width / 2 <= Picture2.Left + Picture2.Width Then
If Picture1.Top + Picture1.Height >= Picture2.Top Then
If Picture1.Top + Picture1.Height <= Picture2.Top + Picture2.Height Then
s = -su
un = un + su
Label1.Caption = un
End If
End If
End If
End If
End Sub
'简单得很,不要见笑,或者我还有一个图书管理系统,一个计算器(不过计算器还有很多BUG)
代码如下:
Option Explicit
Dim t, su, f, h, s, r, un As Integer
Private Sub Form_Activate()
Picture2.SetFocus
End Sub
Private Sub Form_Load()
Form1.Caption = "撞球游戏"
Form1.Top = Screen.Height / 2 - Form1.Height / 2
Form1.Left = Screen.Width / 2 - Form1.Width / 2
Timer1.Enabled = True
Timer1.Interval = 1000
t = 3
Timer2.Enabled = False
Timer3.Enabled = False
Timer2.Interval = 1
Timer3.Interval = 1
Label1.Caption = ""
Label1.Caption = t
su = HScroll1.Value
f = su
h = su
s = su
End Sub
Private Sub HScroll1_Change()
su = HScroll1.Value
Picture2.SetFocus
Timer1.Enabled = True
Timer2.Enabled = False
Timer3.Enabled = False
Picture1.Top = 0
Label1.Caption = t
f = su
h = su
s = su
End Sub
Private Sub Picture2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then
Picture2.Left = Picture2.Left - su
f = -su
Else
If KeyCode = 39 Then
Picture2.Left = Picture2.Left + su
f = su
End If
End If
If Picture2.Left <= 0 Then
Picture2.Left = 0
Else
If Picture2.Left >= Form1.Width - Picture2.Width Then
Picture2.Left = Form1.Width - Picture2.Width
End If
End If
End Sub
Private Sub Timer1_Timer()
t = t - 1
Label1.Caption = t
If t = 0 Then
Timer1.Enabled = False
t = 3
Timer2.Enabled = True
Timer3.Enabled = True
Label1.Caption = ""
End If
End Sub
Private Sub Timer2_Timer()
Picture2.Left = Picture2.Left + f
If Picture2.Left <= 0 Then
f = su
Else
If Picture2.Left >= Form1.Width - Picture2.Width Then
f = -su
End If
End If
End Sub
Private Sub Timer3_Timer()
Picture1.Move Picture1.Left + h, Picture1.Top + s
If Picture1.Left <= 0 Then
h = su
Else
If Picture1.Left >= Form1.Width - Picture1.Width Then
h = -su
End If
End If
If Picture1.Top = 0 Then
s = su
Else
If Picture1.Top >= Form1.Height - Picture1.Height Then
r = MsgBox("你输了,是否重来?", vbYesNo, "撞球游戏")
un = 0
If r = 6 Then
su = HScroll1.Value
Picture2.SetFocus
Timer1.Enabled = True
Timer2.Enabled = False
Timer3.Enabled = False
Picture1.Top = 0
Label1.Caption = t
f = su
h = su
s = su
Else
If r = 7 Then
End
End If
End If
End If
End If
'以下为浮木撞到球时发生的动作
If Picture1.Left + Picture1.Width / 2 >= Picture2.Left Then
If Picture1.Left + Picture1.Width / 2 <= Picture2.Left + Picture2.Width Then
If Picture1.Top + Picture1.Height >= Picture2.Top Then
If Picture1.Top + Picture1.Height <= Picture2.Top + Picture2.Height Then
s = -su
un = un + su
Label1.Caption = un
End If
End If
End If
End If
End Sub
'简单得很,不要见笑,或者我还有一个图书管理系统,一个计算器(不过计算器还有很多BUG)
佚名
2024-06-08 22:58:44
类似问题(10)
-
佚名2024-06-08 06:35:04
问一个动漫人物,求名字和作品!
答啊啊,与各种各样的人见面,这是替人们递送信件的工作。人们称这些即使**上性命,也要把寄托着「人心」的信安全运送的送递员为「信蜂」注。斯威特,拉格为了找回心爱的高...
-
佚名2024-06-08 00:51:47
问求vb作品
答给我发消息吧 邮箱告诉我 我给你发过去 有很多 程序都是全的
-
佚名2024-06-08 23:11:45
问求一张简单的剪纸作品!!!
答一张正方纸,斜折再斜折,成三角状,从开口处梯形状剪起,左右一边一刀,至顶。打开从中拉开既是。
-
佚名2024-06-08 14:07:22
问最近下载了个VB在研究。想制作一个程序。功能如下:
答可以简单点,假设你只有一台打印机并设置为默认打印机,可以直接打印。添加通用对话框,取名dlgFile,菜单:工程-部件,如图打开文件对话框代码dlgFile.S...
-
佚名2024-06-08 15:17:51
问vb如何随机生成一个英文名
答Private Sub Command1_Click()Dim xName As StringDim I As IntegerI = Int(3 + 6 * R...
-
佚名2024-06-08 04:43:31
问求一张剪纸作品
答http:///Article/UploadFiles/200601/@@37436.jpg
-
佚名2024-06-08 04:11:33
问询问一个vb控件的名称。
答这个控件叫:TabStrip在控件空白处 右键-部件-windows common controls 6.0 钩选即可 出现.
-
佚名2024-06-08 00:49:32
问求一个vb小作品万分感谢
答打开VB新建一个exe,然后按下 F7 打开代码页面写入一下代码:Private Sub Form_Load() While 1 MsgBo...
-
佚名2024-06-08 14:00:46
问求一个VB的设计作品
答我可以为你作这个VB的设计作品给我发邮件
-
佚名2024-06-08 08:00:00
问求一个photoshop作品 室徽设计
答LOGO用的是AI 我帮补料你。。
风水
- 1 梦到我和我男朋友还有一群人被软禁了,
- 2 中午睡觉梦见我在一个房间里睡觉,听见一个男人说别动,我在梦中看见自己醒来,回头一看有一只金色高跟鞋
- 3 经常梦见男朋友突然消失,自己哭着喊着找也找不到
- 4 梦见自己和前夫生了个儿子
- 5 梦见一个平时很舍不得买东西的老人大买特买什么意思
- 6 昨晚梦见自己差点掉到桥下去,我抱住桥边,我大声呼救最后得救求解。
- 7 请教2011年1月搬家黄历吉日:
- 8 我装修好的房子,进户门对着楼梯;有人建议中间放一盆景。请教行不行?放什么植物的盆景好?
- 9 夫星入空亡是什么意思啊
- 10 要怎么样去尽快的去忘记一个我最爱的人,我现在和他分手了,心里好痛好痛,求解答,谢谢!
起名
网名
- 1 带童童的网名
- 2 酒伴人心的网名
- 3 一男一女闺蜜网名韩文
- 4 qq昵称怎么弄符号
- 5 舌头的昵称
- 6 妈妈管孩子叫的昵称
- 7 起个文雅的微信昵称
- 8 炫舞昵称女生三个字
- 9 刷宝昵称改不了的原因
- 10 宝贝的微信昵称
说说
- 1 王永强个性签名怎么写
- 2 独角兽个性签名
- 3 阿冷个性签名
- 4 车间的说说
- 5 喝 的说说
- 6 烦心的句子说说心情
- 7 失恋的绝情说说网名
- 8 言语伤害我说说
- 9 qq说说编辑后是重发吗6
- 10 到了一个城市的说说