PROGRAMACIÓ D'APLICACIONS EDUCATIVES AMB VISUAL BASICMÒDUL 3

Fitxer: m3p4.frm

Definició dels objectes. Interfície d'usuari

Recordeu que això no ho podeu editar directament. Per fer-ho incorporeu nous objectes de la paleta en el vostre formulari. I per canviar els valors seleccioneu l'objecte i escolliu la propietat a canviar en la finestra Properties.

VERSION 5.00
Begin VB.Form frmDau 
   Appearance      =   0  'Flat
   AutoRedraw      =   -1  'True
   BackColor       =   &H80000005&
   Caption         =   "DAU"
   ClientHeight    =   2415
   ClientLeft      =   1980
   ClientTop       =   1365
   ClientWidth     =   2715
   BeginProperty Font 
      Name            =   "MS Sans Serif"
      Size            =   8.25
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H80000008&
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2415
   ScaleWidth      =   2715
   Begin VB.CommandButton cmdLlençarDau 
      Appearance      =   0  'Flat
      Caption         =   "Llançar el dau"
      Height          =   375
      Left            =   600
      TabIndex        =   6
      Top             =   1680
      Width           =   1335
   End
   Begin VB.Timer trmDau 
      Enabled         =   0   'False
      Interval        =   10
      Left            =   120
      Top             =   120
   End
   Begin VB.PictureBox picDau 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   855
      Index           =   5
      Left            =   840
      ScaleHeight     =   825
      ScaleWidth      =   825
      TabIndex        =   5
      Top             =   600
      Visible         =   0   'False
      Width           =   855
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   20
         Left            =   0
         Shape           =   3  'Circle
         Top             =   0
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   19
         Left            =   480
         Shape           =   3  'Circle
         Top             =   0
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   18
         Left            =   480
         Shape           =   3  'Circle
         Top             =   240
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   17
         Left            =   0
         Shape           =   3  'Circle
         Top             =   240
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   16
         Left            =   0
         Shape           =   3  'Circle
         Top             =   480
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   5
         Left            =   480
         Shape           =   3  'Circle
         Top             =   480
         Width           =   375
      End
   End
   Begin VB.PictureBox picDau 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   855
      Index           =   4
      Left            =   840
      ScaleHeight     =   825
      ScaleWidth      =   825
      TabIndex        =   4
      Top             =   600
      Visible         =   0   'False
      Width           =   855
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   15
         Left            =   0
         Shape           =   3  'Circle
         Top             =   0
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   14
         Left            =   480
         Shape           =   3  'Circle
         Top             =   0
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   13
         Left            =   480
         Shape           =   3  'Circle
         Top             =   480
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   12
         Left            =   0
         Shape           =   3  'Circle
         Top             =   480
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   4
         Left            =   240
         Shape           =   3  'Circle
         Top             =   240
         Width           =   375
      End
   End
   Begin VB.PictureBox picDau 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   855
      Index           =   3
      Left            =   840
      ScaleHeight     =   825
      ScaleWidth      =   825
      TabIndex        =   3
      Top             =   600
      Visible         =   0   'False
      Width           =   855
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   11
         Left            =   0
         Shape           =   3  'Circle
         Top             =   0
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   10
         Left            =   480
         Shape           =   3  'Circle
         Top             =   0
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   9
         Left            =   480
         Shape           =   3  'Circle
         Top             =   600
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   3
         Left            =   0
         Shape           =   3  'Circle
         Top             =   600
         Width           =   375
      End
   End
   Begin VB.PictureBox picDau 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   855
      Index           =   2
      Left            =   840
      ScaleHeight     =   825
      ScaleWidth      =   825
      TabIndex        =   2
      Top             =   600
      Visible         =   0   'False
      Width           =   855
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   8
         Left            =   480
         Shape           =   3  'Circle
         Top             =   0
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   6
         Left            =   0
         Shape           =   3  'Circle
         Top             =   480
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   2
         Left            =   240
         Shape           =   3  'Circle
         Top             =   240
         Width           =   375
      End
   End
   Begin VB.PictureBox picDau 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   855
      Index           =   1
      Left            =   840
      ScaleHeight     =   825
      ScaleWidth      =   825
      TabIndex        =   1
      Top             =   600
      Visible         =   0   'False
      Width           =   855
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   7
         Left            =   480
         Shape           =   3  'Circle
         Top             =   0
         Width           =   375
      End
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   1
         Left            =   0
         Shape           =   3  'Circle
         Top             =   480
         Width           =   375
      End
   End
   Begin VB.PictureBox picDau 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   855
      Index           =   0
      Left            =   840
      ScaleHeight     =   825
      ScaleWidth      =   825
      TabIndex        =   0
      Top             =   600
      Width           =   855
      Begin VB.Shape shpPunt 
         BackColor       =   &H00000000&
         BackStyle       =   1  'Opaque
         Height          =   255
         Index           =   0
         Left            =   240
         Shape           =   3  'Circle
         Top             =   240
         Width           =   375
      End
   End
End


Codi del programa. Programació de respostes a events

Attribute VB_Name = "frmDau"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Dim NúmeroSortitDau As Integer

Private Sub cmdLlençarDau_Click()
    trmDau.Enabled = True
End Sub

Private Sub Form_Load()
    Randomize
    NúmeroSortitDau = 1
End Sub

Private Sub trmDau_Timer()
    Static Vegades As Integer

    picDau(NúmeroSortitDau).Visible = False
    NúmeroSortitDau = Int(6 * Rnd)
    Beep
    picDau(NúmeroSortitDau).Visible = True
    picDau(NúmeroSortitDau).Refresh
    Vegades = Vegades + 1
    If Vegades = 10 Then
        trmDau.Enabled = False
        Vegades = 0
    End If
End Sub