用簡單的方法實現Bingo隨機出號動態效果
公司舉辦年會要做個Bingo抽獎遊戲,請我開發這個Bingo程式。
現功能已按要求做好。其中的隨機出號效果用了幾個由小到大的 Label 來簡單實現。主要VB.NET 程式碼如下:
hitIndex = rand.Next(0, numRemainList.Count - 1)
hitNum = numRemainList.Item(hitIndex)
LabelD1.Text = hitNum
LabelD2.Text = hitNum
LabelD3.Text = hitNum
LabelD4.Text = hitNum
LabelD1.Visible = True
LabelD2.Visible = False
LabelD3.Visible = False
LabelD4.Visible = False
Me.Refresh()
System.Threading.Thread.Sleep(200)
LabelD1.Visible = False
LabelD2.Visible = True
Me.Refresh()
System.Threading.Thread.Sleep(300)
LabelD2.Visible = False
LabelD3.Visible = True
Me.Refresh()
System.Threading.Thread.Sleep(500)
LabelD3.Visible = False
LabelD4.Visible = True
Me.Refresh()
System.Threading.Thread.Sleep(1000)
LabelD4.Visible = False
Me.Refresh()
RichTextBoxSelected.Text &= hitNum & " "
Me.Refresh()