真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vbnet打地鼠 vb打地鼠代碼

如何用VB程序設(shè)計(jì)打地鼠游戲

下面是源代碼:

成都創(chuàng)新互聯(lián)公司2013年至今,先為隴縣等服務(wù)建站,隴縣等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為隴縣企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

Form1:

Private Sub Form_Load() Dim temp As Integer Randomize

temp = Int(Rnd * 3) + 1

Form1.Picture = LoadPicture("C:\Users\Administrator\Desktop\打地鼠\picture" temp ".jpg") WindowsMediaPlayer1.URL = "C:\Users\Administrator\Desktop\打地鼠\Heaven's Devils.wma" End Sub

Private Sub Label1_Click() Form2.Show Form2.num = -1 Form1.Hide

WindowsMediaPlayer1.URL = ""

Open "C:\Users\Administrator\Desktop\打地鼠\primary.dat" For Append As #1 '寫操作 Close #1

Open "C:\Users\Administrator\Desktop\打地鼠\intermediate.dat" For Append As #2 Close #2

Open "C:\Users\Administrator\Desktop\打地鼠\advanced.dat" For Append As #3 Close #3 End Sub

Private Sub Label2_Click() End End Sub

Form2:

Dim allnum As Integer, oknum As Integer '定義變化次數(shù) 打中次數(shù) Public num As Integer '判別是否第一次開始游戲 Dim flags1 As Boolean '判別文件是否保存 Public flags As Boolean '判別是否播放聲音 Private Sub countine_Click() pause.Enabled = True Timer1.Enabled = True countine.Enabled = False WLXZ.Enabled = True End Sub

Private Sub exit_Click() Dim X As Integer Dim tt As Integer

X = MsgBox("是否真的退出?", vbYesNo, "退出游戲框")

If X = 6 Then

tt = MsgBox("退出游戲之前,是否保存", vbYesNo, "保存提示") If tt = 6 Then

If flags1 = True Then End Else

If Timer1.Interval = 1000 Then

Open "C:\Users\Administrator\Desktop\打地鼠\primary.dat" For Append As #1 '寫操作

Print #1, Text1.Text + " " + Format(Date, "M/d/yy") Close #1

ElseIf Timer1.Interval = 500 Then

Open "C:\Users\Administrator\Desktop\打地鼠\intermediate.dat" For Append As #2

Print #2, Text1.Text + " " + Format(Date, "M/d/yy") Close #2 Else

Open "C:\Users\Administrator\Desktop\打地鼠\advanced.dat" For Append As #3

Print #3, Text1.Text + " " + Format(Date, "M/d/yy") Close #3 End If End If End If End End If End Sub

Private Sub Form_Load() Form4.Check1.Value = 1

WindowsMediaPlayer1.Controls.stop countine.Enabled = False pause.Enabled = False WLXZ.Enabled = False

Form5.Top = Form2.Top + 700 Form5.Left = Form2.Left flags1 = False flags = True End Sub

Private Sub help_Click() Form3.Show End Sub

Private Sub new_game_Click() num = num + 1 Dim t As Integer

If (num 0) Then

t = MsgBox("新游戲開始之前,是否保存", vbYesNo, "保存提示") If t = 6 Then

flags1 = True

If Timer1.Interval = 1000 Then

Open "C:\Users\Administrator\Desktop\打地鼠\primary.dat" For Append As #1 '寫操作

Print #1, Text1.Text + " " + Format(Date, "M/d/yy") Close #1

ElseIf Timer1.Interval = 500 Then

Open "C:\Users\Administrator\Desktop\打地鼠\intermediate.dat" For Append As #2

Print #2, Text1.Text + " " + Format(Date, "M/d/yy") Close #2 Else

Open "C:\Users\Administrator\Desktop\打地鼠\advanced.dat" For Append As #3

Print #3, Text1.Text + " " + Format(Date, "M/d/yy") Close #3 End If End If End If

Call Form_Load

allnum = 0 '變化次數(shù)初始為0 oknum = 0 '打中次數(shù)初始為0 Timer1.Enabled = True pause.Enabled = True WLXZ.Enabled = True End Sub

Private Sub options_Click() Timer1.Enabled = False Form4.Show

WLXZ.Enabled = False countine.Enabled = True End Sub

Private Sub pause_Click() Dim r, g, b As Integer Timer1.Enabled = False countine.Enabled = True pause.Enabled = False WLXZ.Enabled = False

Form5.Top = Form2.Top + 700 Form5.Left = Form2.Left Form5.Show

VB制作打地鼠游戲的圖片問題

添加Imgae控件,在Image中添加圖片

然后調(diào)用

Picture1(pre).Picture = Image1.Picture

求助:VB中打地鼠點(diǎn)擊中了加分的代碼過程。要不你教教我怎么做也行。不是很明白●﹏●

Private Sub Image1_Click()

n = n + 1 '分?jǐn)?shù)。

Image1.Visible = False '點(diǎn)中后隱藏 防止多次點(diǎn)擊重復(fù)計(jì)分。

End Sub

VB打地鼠怎么把鼠標(biāo)變錘子啊 求指導(dǎo) 求代碼。。。謝謝哈

首先你要找一個(gè) 錘子的 ICO 圖標(biāo)文件

點(diǎn)擊右邊工程里的form (窗體) 的屬性 選擇MouseIcon 然后選擇 錘子圖標(biāo)的路徑 就可以了

如果是運(yùn)行或者特定時(shí) 把鼠標(biāo)變錘子,首先把窗體的MousePointer 屬性 設(shè)定為99-Custom(自定義圖標(biāo))

在需要的時(shí)候 加上

Form1.MouseIcon = LoadPicture("d:\1.ico") '把d:\1.ico ,改成你圖標(biāo)所在的路徑

期末老師讓做一個(gè)比較有創(chuàng)意的vb.net小軟件,無從下手!求幫忙

隨手做了個(gè)打地鼠,代碼拿去吧。

下圖是10x10超大窗體“打地鼠”

直接新建個(gè)窗體,覆蓋全部代碼,不需要拖控件,全部動態(tài)創(chuàng)建了。

參數(shù)都在前面幾行,可以隨便改。

格子寬和高是70,間距20,因此橫格子和豎格子不要超過10,不然窗體會擴(kuò)張到非常大的程度。

調(diào)整時(shí)鐘的Interval可決定地鼠的出現(xiàn)頻率,你可以修改變化概率?=?15這句話改變出現(xiàn)幾率。

Public?Class?Form1

Dim?橫格子?=?4

Dim?豎格子?=?4

Dim?背景色?=?Color.Bisque

Dim?打中色?=?Color.LawnGreen

Dim?失誤色?=?Color.Red

Dim?按鈕(橫格子,?豎格子)?As?Button

Public?WithEvents?時(shí)鐘?As?New?Timer?With?{.Interval?=?400}

Public?WithEvents?分?jǐn)?shù)板?As?New?Label?With?{.AutoSize?=?False,?.Width?=?120,?

.Height?=?26}

Dim?字體?=?New?Font("黑體",?14)

Dim?隨機(jī)數(shù)?As?New?Random

Dim?打中數(shù)?As?Integer?=?0

Dim?分?jǐn)?shù)?As?Integer?=?0

Private?Sub?Form1_Load(sender?As?Object,?e?As?EventArgs)?Handles?MyBase.Load

Me.Font?=?字體

For?x?=?1?To?橫格子

For?y?=?1?To?豎格子

按鈕(x,?y)?=?New?Button()

Me.Controls.Add(按鈕(x,?y))

按鈕(x,?y).Width?=?70

按鈕(x,?y).Height?=?70

按鈕(x,?y).Text?=?""

按鈕(x,?y).Location?=?New?Point((x?-?1)?*?(按鈕(x,?y).Width?+?20)?+?

20,?(y?-?1)?*?(按鈕(x,?y).Height?+?20)?+?20)

按鈕(x,?y).Name?=?String.Format("Button_{0}_{1}",?x,?y)

按鈕(x,?y).BackColor?=?背景色

按鈕(x,?y).FlatStyle?=?FlatStyle.Flat

按鈕(x,?y).Tag?=?0

AddHandler?按鈕(x,?y).Click,?AddressOf?按鈕點(diǎn)擊

Next

Next

Me.Text?=?"打地鼠"??"??[空格鍵暫停]"

Me.KeyPreview?=?True

Dim?k?=?按鈕(橫格子,?豎格子)

Me.Width?=?k.Left?+?k.Width?+?40

Me.Height?=?k.Top?+?k.Height?+?65

Me.Controls.Add(分?jǐn)?shù)板)

分?jǐn)?shù)板.Location?=?New?Point(Me.Width?/?2?-?25,?0)

分?jǐn)?shù)板.Text?=?"分?jǐn)?shù)牌"

時(shí)鐘.Enabled?=?True

End?Sub

Private?Sub?按鈕點(diǎn)擊(sender?As?Object,?e?As?EventArgs)

If?時(shí)鐘.Enabled?=?False?Then?Exit?Sub

Dim?控件名?=?CType(sender,?Button).Name.Split("_")

Dim?x?=?CInt(控件名(1))?'截取_分割的第二部分Button_{0}_{1}

Dim?y?=?CInt(控件名(2))?'截取_分割的第三部分Button_{0}_{1}

If?按鈕(x,?y)?IsNot?Nothing?Then

If?按鈕(x,?y).Text?=?"地鼠"?Then

打中數(shù)?=?打中數(shù)?+?1

分?jǐn)?shù)?=?分?jǐn)?shù)?+?20

按鈕(x,?y).Text?=?打中數(shù)??"!"

分?jǐn)?shù)板.Text?=?"得分:"??分?jǐn)?shù)

按鈕(x,?y).BackColor?=?打中色

按鈕(x,?y).Tag?=?1

ElseIf?按鈕(x,?y).Text?=?""?Then

分?jǐn)?shù)?=?分?jǐn)?shù)?-?20

If?分?jǐn)?shù)??0?Then?分?jǐn)?shù)?=?0

分?jǐn)?shù)板.Text?=?"得分:"??分?jǐn)?shù)

按鈕(x,?y).Text?=?"亂打!"

按鈕(x,?y).BackColor?=?失誤色

按鈕(x,?y).Tag?=?2

End?If

End?If

End?Sub

Private?Sub?時(shí)鐘_Tick(sender?As?Object,?e?As?EventArgs)?Handles?時(shí)鐘.Tick

For?x?=?1?To?橫格子

For?y?=?1?To?豎格子

Dim?變化概率?=?隨機(jī)數(shù).Next(1,?100)

If?變化概率?=?40?Then

If?按鈕(x,?y).Tag?=?1?Or?按鈕(x,?y).Tag?=?2?Then

按鈕(x,?y).Text?=?""

按鈕(x,?y).BackColor?=?背景色

按鈕(x,?y).Tag?=?0

End?If

End?If

If?變化概率?=?15?Then

If?按鈕(x,?y).Text?=?"地鼠"?Then

按鈕(x,?y).Text?=?""

ElseIf?按鈕(x,?y).Text?=?""?Then

按鈕(x,?y).Text?=?"地鼠"

End?If

End?If

Next

Next

End?Sub

Private?Sub?Form1_KeyUp(sender?As?Object,?e?As?KeyEventArgs)?Handles?

MyBase.KeyUp

If?e.KeyCode?=?Keys.Space?Then?時(shí)鐘.Enabled?=?Not?時(shí)鐘.Enabled

End?Sub

End?Class

如滿意,請采納,謝謝。

求大神指導(dǎo)用vb怎么做打地鼠游戲

1、控件:

Picture1(0~8) 排三列三排

Timer1 Interval設(shè)為1000

Text1 Text 設(shè)為0

Command1 caption 設(shè)為“開始”

2、代碼:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Dim m, i, n As Integer

Private Sub Form_Load()

Timer1.Enabled = False

For l = 0 To 8

Picture1(l).Visible = False

Next l

End Sub

Private Sub Command1_Click()

Timer1.Enabled = True

End Sub

Private Sub Timer1_Timer()

If i 9 Then

Picture1(i).Visible = False

End If

Randomize

i = (Rnd() * 8) Mod 10

Picture1(i).Visible = True

Picture1(i).ZOrder

If n = 10 Then

Picture1(i).Visible = False

If Text1 = 80 Then

m = m + 1

c = MsgBox("恭喜你過關(guān)了。你的得分為" Text1 vbCrLf "是否進(jìn)入" m + 1 "關(guān)", 4)

If c = vbYes Then

Timer1.Interval = Timer1.Interval - 100 * (11 - m) / 10

Else

Timer1.Enabled = False

End If

Else

MsgBox "請重新開始!"

End If

n = 0

Text1 = 0

End If

n = n + 1

End Sub

Private Sub Picture1_Click(Index As Integer)

Select Case Index

Case Index

If Index = i Then

Timer1.Enabled = False

Text1 = Text1 + 10

MsgBox "恭喜你!"

Timer1.Enabled = True

End If

End Select

End Sub


本文題目:vbnet打地鼠 vb打地鼠代碼
鏈接地址:http://weahome.cn/article/doojpid.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部