Post on 05-Jan-2016
description
計算機程式及實習期末報告製作
題目 : 對對碰學校 : 南台科技大學系所 : 機械工程系班級 : 自控一甲學號 : 4A212034學生 : 洪濬森指導老師 : 謝慶存
題目說明 只要按出兩相同圖案,就成功了 !!
版面介紹
pic1
pic1
pic1
pic1
pic2
pic1
圖片檔
程式碼Public Class Form1
Public Class Form1 Dim num1, num2 As Integer Private Sub Form1_Load(sender As System.Object, e
As System.EventArgs) Handles MyBase.Load pic1.Enabled = False pic2.Enabled = False pic1.SizeMode = PictureBoxSizeMode.StretchImage pic2.SizeMode = PictureBoxSizeMode.StretchImage pic1.Image = New Bitmap("Pokerbk.jpg") pic2.Image = New Bitmap("Pokerbk.jpg") lblMsg.Text = "按o洗~牌gP鈕 s遊C戲﹐開
Private Sub btnShuffle_Click(sender As System.Object, e As System.EventArgs) Handles btnShuffle.Click pic1.Enabled = True pic2.Enabled = True btnShuffle.Enabled = False pic1.Image = New Bitmap("Pokerbk.jpg") pic2.Image = New Bitmap("Pokerbk.jpg") Randomize() num1 = Int(Rnd() * 14) + 1 num2 = Int(Rnd() * 14) + 1 lblMsg.Text = "請 D在 b圖 I片 u上W按 o一@下U選 i取 Lu .." My.Computer.Audio.Stop() End Sub
Private Sub pic1_Click(sender As System.Object, e As System.EventArgs) Handles pic1.Click
pic1.Image = New Bitmap("Poker" & num1 & ".jpg") pic2.Image = New Bitmap("Poker" & num2 & ".jpg") If num1 > num2 Then lblMsg.Text = “再試一次 " Else If num1 = num2 Then lblMsg.Text = "LUCKY" My.Computer.Audio.Play(My.Resources.kick,
AudioPlayMode.Background) Else lblMsg.Text = "再試一次 " End If End If pic1.Enabled = False pic2.Enabled = False btnShuffle.Enabled = True End Sub
Private Sub pic2_Click(sender As System.Object, e As System.EventArgs) Handles pic2.Click
pic1.Image = New Bitmap("Poker" & num1 & ".jpg") pic2.Image = New Bitmap("Poker" & num2 & ".jpg") If num2 > num1 Then lblMsg.Text = "Try again" Else If num2 = num1 Then lblMsg.Text = "LUCKY" My.Computer.Audio.Play(My.Resources.kick,
AudioPlayMode.Background) Else lblMsg.Text = "Try again" End If End If pic1.Enabled = False pic2.Enabled = False btnShuffle.Enabled = True End Sub
心得 這次的課程讓我學到不少東西 , 例如程式編輯這
方面的東西 , 希望以後能夠用的到 也很高興能上到這門課程 .
參考文獻 Visual Basic 2010 基礎必
修課
老師課堂上的教導
學長的範例