📄 frmrolldice.frm
字号:
VERSION 5.00
Begin VB.Form frmRollDice
Caption = "Fig. 6.16: Simulating rolling six-sided dice"
ClientHeight = 3690
ClientLeft = 2565
ClientTop = 1425
ClientWidth = 5040
LinkTopic = "Form1"
ScaleHeight = 3690
ScaleWidth = 5040
Begin VB.CommandButton cmdRoll
Caption = "Roll"
Height = 495
Left = 1980
TabIndex = 0
Top = 3015
Width = 1215
End
Begin VB.Image imgDie1
Height = 645
Left = 330
Top = 210
Width = 810
End
Begin VB.Image imgDie4
Height = 645
Left = 3855
Top = 210
Width = 810
End
Begin VB.Image imgDie2
Height = 645
Left = 1515
Top = 210
Width = 810
End
Begin VB.Image imgDie7
Height = 645
Left = 2745
Top = 1065
Width = 810
End
Begin VB.Image imgDie9
Height = 645
Left = 330
Top = 1920
Width = 810
End
Begin VB.Image imgDie10
Height = 645
Left = 1515
Top = 1920
Width = 810
End
Begin VB.Image imgDie11
Height = 645
Left = 2745
Top = 1920
Width = 810
End
Begin VB.Image imgDie12
Height = 645
Left = 3855
Top = 1920
Width = 810
End
Begin VB.Image imgDie8
Height = 645
Left = 3855
Top = 1065
Width = 810
End
Begin VB.Image imgDie3
Height = 645
Left = 2745
Top = 210
Width = 810
End
Begin VB.Image imgDie5
Height = 645
Left = 330
Top = 1065
Width = 810
End
Begin VB.Image imgDie6
Height = 645
Left = 1515
Top = 1065
Width = 810
End
End
Attribute VB_Name = "frmRollDice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 6.16
' Six-sided die simulation
Option Explicit ' General declaration
Private Sub cmdRoll_Click()
Call DisplayDie(imgDie1, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie2, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie3, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie4, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie5, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie6, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie7, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie8, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie9, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie10, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie11, 1 + Int(6 * Rnd()))
Call DisplayDie(imgDie12, 1 + Int(6 * Rnd()))
End Sub
Private Sub DisplayDie(imgDie As Image, face As Integer)
imgDie.Picture = LoadPicture("d:\images\common\die" _
& face & ".gif")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -