| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3566 人关注过本帖
标题:用vb.net编写的猜数字游戏
只看楼主 加入收藏
guyan1220
Rank: 1
等 级:新手上路
帖 子:100
专家分:0
注 册:2006-5-22
收藏
 问题点数:0 回复次数:20 
用vb.net编写的猜数字游戏
希望有vb.net兴趣的人加我QQ:109501246 邮箱:guizhongyingjigzj@3126.com
有vb.net编的猜数字游戏
EbR97m6u.rar (12.64 KB) 用vb.net编写的猜数字游戏


搜索更多相关主题的帖子: 数字 游戏 编写 
2006-05-22 16:34
guyan1220
Rank: 1
等 级:新手上路
帖 子:100
专家分:0
注 册:2006-5-22
收藏
得分:0 
为什么没人 发表意见呢
2006-05-23 09:31
漫漫小生
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-5-16
收藏
得分:0 
你那游戏怎么玩的啊?怎么不懂?
还有源文件呢?

[此贴子已经被作者于2006-5-23 11:41:38编辑过]


学软件的菜鸟一个,请多多指教!
2006-05-23 11:41
wstcl
Rank: 1
等 级:新手上路
帖 子:381
专家分:5
注 册:2005-8-17
收藏
得分:0 
以下是引用漫漫小生在2006-5-23 11:41:00的发言:
你那游戏怎么玩的啊?怎么不懂?
还有源文件呢?

就是


Love Baby
2006-05-23 14:43
guyan1220
Rank: 1
等 级:新手上路
帖 子:100
专家分:0
注 册:2006-5-22
收藏
得分:0 

猜大小 会有提示 代码如下:
Public Class Form1
Inherits System.Windows.Forms.Form

Dim num As Integer = -1, str As String, tsum As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsure.Click
If num = -1 Then
MsgBox("您还没有点击开始!", MsgBoxStyle.Critical, "系统提示")
Exit Sub
End If
If tsum = 0 Then
MsgBox("时间已到,请重新开始!", MsgBoxStyle.OKOnly, "系统提示")
Exit Sub
End If
If txtnum.Text < "0 " Or txtnum.Text > "9999" Then
Labanser.ForeColor = ColorTranslator.FromOle(QBColor(15))
Labanser.Text = "您输入的数字超出了范围!"
txtnum.Text = ""
ElseIf Val(txtnum.Text) > num Then
Labanser.ForeColor = ColorTranslator.FromOle(QBColor(14))
Labanser.Text = "数字" & txtnum.Text & "太大了!"
txtnum.Text = ""
ElseIf Val(txtnum.Text) < num Then
Labanser.ForeColor = ColorTranslator.FromOle(QBColor(10))
Labanser.Text = "数字 " & txtnum.Text & " 太小了!"
txtnum.Text = ""
ElseIf Val(txtnum.Text) = num Then
Labanser.ForeColor = ColorTranslator.FromOle(QBColor(11))
Labanser.Text = "恭喜您猜对了!"
Timer3.Enabled = False
End If
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Labanser.Left > 85 Then
Labanser.Left = Labanser.Left - 3
Else : Labanser.Left = 304
Timer1.Enabled = False
txtnum.Focus()
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cai.Left = 144 : cai.Top = 0 : shu.Left = -48 : shu.Top = 96 : zi.Left = 304 : zi.Top = 96
tw1.Enabled = True
tsum = 0
rb1.Checked = True
Timer1.Enabled = False
Timer4.Enabled = True
Labanser.Left = 304 : Labanser.Top = 96
End Sub
Private Sub tw1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tw1.Tick
If cai.Left = 144 And cai.Top < 96 Then
cai.Top = cai.Top + 3
ElseIf cai.Left = 144 And cai.Top = 96 Then
tw1.Enabled = False
tw2.Enabled = True
End If
End Sub
Private Sub tw2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tw2.Tick
If shu.Top = 96 And shu.Left < 144 Then
shu.Left = shu.Left + 6
ElseIf shu.Top = 96 And shu.Left = 144 Then
tw2.Enabled = False
tw3.Enabled = True
End If
End Sub
Private Sub tw3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tw3.Tick
If zi.Top = 96 And zi.Left > 144 Then
zi.Left = zi.Left - 8
ElseIf zi.Left = 144 And zi.Top = 96 Then
tw3.Enabled = False
topen.Enabled = True
topen1.Enabled = True
End If
End Sub
Private Sub topen_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles topen.Tick
If cai.Left > 96 And cai.Top = 96 Then
cai.Left = cai.Left - 2
ElseIf cai.Left = 96 And cai.Top = 96 Then
topen.Enabled = False
End If
End Sub
Private Sub topen1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles topen1.Tick
If zi.Top = 96 And zi.Left < 192 Then
zi.Left = zi.Left + 2
ElseIf zi.Left = 192 And zi.Top = 96 Then
topen1.Enabled = False
End If
End Sub
Private Sub btnstar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstar.Click
tw1.Enabled = False : tw2.Enabled = False : tw3.Enabled = False : Timer4.Enabled = False
cai.Visible = False : shu.Visible = False : zi.Visible = False
Timer3.Enabled = True
If rb1.Checked = True Then
tsum = 81
ElseIf rb2.Checked = True Then
tsum = 61
ElseIf rb3.Checked = True Then
tsum = 41
End If
Randomize()
num = Int(Rnd() * 10000)
txtnum.Text = ""
txtnum.Focus()
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Label3.Text = TimeOfDay
End Sub

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
tsum = tsum - 1
Label2.Text = "还剩" & tsum & "秒"
If tsum = 0 Then
Timer3.Enabled = False
MsgBox("时间到!", MsgBoxStyle.OKOnly, "系统提示")
Labanser.ForeColor = ColorTranslator.FromOle(QBColor(0))
Labanser.Text = "正确的数字是:" & num & ""
Timer1.Enabled = True
Label2.Text = ""
Timer3.Enabled = False
End If
End Sub

Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
End
End Sub
Dim x As Integer = 0
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick

If topen.Enabled = False And topen1.Enabled = False Then
x = x + 1
End If
If x = 2 Then
cai.Visible = False
shu.Visible = False
zi.Visible = False
x = 0
tw1.Enabled = True
cai.Left = 144 : cai.Top = 0 : shu.Left = -48 : shu.Top = 96 : zi.Left = 304 : zi.Top = 96
cai.Visible = True : shu.Visible = True : zi.Visible = True
End If
End Sub
End Class

2006-05-25 22:28
但锐
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-6-3
收藏
得分:0 
谢谢~~我选研究研究~~
2006-06-03 23:49
guyan1220
Rank: 1
等 级:新手上路
帖 子:100
专家分:0
注 册:2006-5-22
收藏
得分:0 
如果有问题的话给我留言
2006-06-05 13:32
aristotle
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-4-30
收藏
得分:0 
tw1,tw2,tw3 label3,topen都什么意思啊?
还有猜数字这三个字是怎么实现的?不好意思我是 菜鸟
2006-06-16 10:45
Ver
Rank: 1
等 级:新手上路
帖 子:173
专家分:0
注 册:2006-2-8
收藏
得分:0 
简单

我用古老的咒语重温,吟唱灵魂序曲寻根 面对魔界的邪吻,不被污染的转身,维持纯白的象徵然后还原为人
2006-06-16 12:50
xocy9ck
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-6-7
收藏
得分:0 
我有兴趣,QQ:627792681   我是学习计算机的普通大学生,.
2006-06-20 21:07
快速回复:用vb.net编写的猜数字游戏
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041926 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved