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

Fitxer: m3p3.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 frmColor 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   Caption         =   "COLORS"
   ClientHeight    =   2295
   ClientLeft      =   2280
   ClientTop       =   1920
   ClientWidth     =   4575
   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"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2295
   ScaleWidth      =   4575
   Begin VB.CommandButton cmdEsborrar 
      Appearance      =   0  'Flat
      Caption         =   "Esborrar els colors"
      Height          =   375
      Left            =   240
      TabIndex        =   7
      Top             =   120
      Width           =   2175
   End
   Begin VB.OptionButton OptColor 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Blau"
      ForeColor       =   &H80000008&
      Height          =   255
      Index           =   2
      Left            =   360
      TabIndex        =   6
      Top             =   1680
      Width           =   1215
   End
   Begin VB.OptionButton OptColor 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Vermell"
      ForeColor       =   &H80000008&
      Height          =   255
      Index           =   1
      Left            =   360
      TabIndex        =   5
      Top             =   1320
      Width           =   1215
   End
   Begin VB.OptionButton OptColor 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Verd"
      ForeColor       =   &H80000008&
      Height          =   255
      Index           =   0
      Left            =   360
      TabIndex        =   4
      Top             =   960
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "COLORS"
      ForeColor       =   &H80000008&
      Height          =   1335
      Left            =   240
      TabIndex        =   3
      Top             =   720
      Width           =   2175
   End
   Begin VB.TextBox txtText 
      Appearance      =   0  'Flat
      Height          =   285
      Index           =   2
      Left            =   2760
      TabIndex        =   2
      Top             =   1680
      Width           =   1575
   End
   Begin VB.TextBox txtText 
      Appearance      =   0  'Flat
      Height          =   285
      Index           =   1
      Left            =   2760
      TabIndex        =   1
      Top             =   1320
      Width           =   1575
   End
   Begin VB.TextBox txtText 
      Appearance      =   0  'Flat
      Height          =   285
      Index           =   0
      Left            =   2760
      TabIndex        =   0
      Top             =   960
      Width           =   1575
   End
End


Codi del programa. Programació de respostes a events

Attribute VB_Name = "frmColor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdEsborrar_Click()
   Dim i As Integer

   For i = 0 To 2
    txtText(i).BackColor = RGB(255, 255, 255)
   Next
End Sub

Private Sub Form_Load()
   Dim i As Integer

   For i = 1 To 2
     txtText(i).BackColor = RGB(255, 255, 255)
   Next
End Sub

Private Sub OptColor_Click(INDEX As Integer)
   Dim j As Integer

   Select Case INDEX
    Case 0
     txtText(INDEX).BackColor = RGB(0, 255, 0)
    Case 1
     txtText(INDEX).BackColor = RGB(255, 0, 0)
    Case 2
     txtText(INDEX).BackColor = RGB(0, 0, 255)
   End Select
   For j = 0 To 2
     If j <> INDEX Then txtText(j).BackColor = RGB(255, 255, 255)
   Next
End Sub