www.pudn.com > the PC Host examples .zip > LPdisplay.frm


VERSION 5.00 
Begin VB.Form DisplayWindow  
   BackColor       =   &H00FF8080& 
   Caption         =   "USB Design By Example: Lighting Control Panel" 
   ClientHeight    =   5595 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   8475 
   FillColor       =   &H00FFFFFF& 
   FillStyle       =   0  'Solid 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   5595 
   ScaleWidth      =   8475 
   StartUpPosition =   3  'Windows Default 
   Begin VB.VScrollBar Slider  
      Height          =   2295 
      Index           =   6 
      Left            =   7080 
      Max             =   0 
      Min             =   255 
      TabIndex        =   12 
      Top             =   2400 
      Width           =   255 
   End 
   Begin VB.VScrollBar Slider  
      Height          =   2295 
      Index           =   5 
      Left            =   5760 
      Max             =   0 
      Min             =   255 
      TabIndex        =   10 
      Top             =   2400 
      Width           =   255 
   End 
   Begin VB.VScrollBar Slider  
      Height          =   2295 
      Index           =   4 
      Left            =   4800 
      Max             =   0 
      Min             =   255 
      TabIndex        =   8 
      Top             =   2400 
      Width           =   255 
   End 
   Begin VB.VScrollBar Slider  
      Height          =   2295 
      Index           =   3 
      Left            =   3840 
      Max             =   0 
      Min             =   255 
      TabIndex        =   6 
      Top             =   2400 
      Width           =   255 
   End 
   Begin VB.VScrollBar Slider  
      Height          =   2295 
      Index           =   2 
      Left            =   2880 
      Max             =   0 
      Min             =   255 
      TabIndex        =   4 
      Top             =   2400 
      Width           =   255 
   End 
   Begin VB.VScrollBar Slider  
      Height          =   2295 
      Index           =   1 
      Left            =   1920 
      Max             =   0 
      Min             =   255 
      TabIndex        =   2 
      Top             =   2400 
      Width           =   255 
   End 
   Begin VB.VScrollBar Slider  
      Height          =   2295 
      Index           =   0 
      Left            =   960 
      Max             =   0 
      Min             =   255 
      TabIndex        =   0 
      Top             =   2400 
      Width           =   255 
   End 
   Begin VB.Label Label1  
      Alignment       =   2  'Center 
      BackStyle       =   0  'Transparent 
      Caption         =   "Lighting Control Panel" 
      BeginProperty Font  
         Name            =   "Arial Rounded MT Bold" 
         Size            =   24 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFFFF& 
      Height          =   1095 
      Left            =   0 
      TabIndex        =   14 
      Top             =   480 
      Width           =   8535 
   End 
   Begin VB.Label Label  
      Alignment       =   2  'Center 
      BackStyle       =   0  'Transparent 
      Caption         =   "Master" 
      BeginProperty Font  
         Name            =   "Arial Rounded MT Bold" 
         Size            =   18 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFFFF& 
      Height          =   615 
      Index           =   6 
      Left            =   6480 
      TabIndex        =   13 
      Top             =   5040 
      Width           =   1575 
   End 
   Begin VB.Label Label  
      Alignment       =   2  'Center 
      BackStyle       =   0  'Transparent 
      Caption         =   "6" 
      BeginProperty Font  
         Name            =   "Arial Rounded MT Bold" 
         Size            =   24 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFFFF& 
      Height          =   615 
      Index           =   5 
      Left            =   5520 
      TabIndex        =   11 
      Top             =   4920 
      Width           =   735 
   End 
   Begin VB.Shape Light  
      FillColor       =   &H0000FFFF& 
      FillStyle       =   0  'Solid 
      Height          =   735 
      Index           =   5 
      Left            =   5520 
      Shape           =   3  'Circle 
      Top             =   1440 
      Width           =   735 
   End 
   Begin VB.Label Label  
      Alignment       =   2  'Center 
      BackStyle       =   0  'Transparent 
      Caption         =   "5" 
      BeginProperty Font  
         Name            =   "Arial Rounded MT Bold" 
         Size            =   24 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFFFF& 
      Height          =   615 
      Index           =   4 
      Left            =   4560 
      TabIndex        =   9 
      Top             =   4920 
      Width           =   735 
   End 
   Begin VB.Shape Light  
      FillColor       =   &H00008080& 
      FillStyle       =   0  'Solid 
      Height          =   735 
      Index           =   4 
      Left            =   4560 
      Shape           =   3  'Circle 
      Top             =   1440 
      Width           =   735 
   End 
   Begin VB.Label Label  
      Alignment       =   2  'Center 
      BackStyle       =   0  'Transparent 
      Caption         =   "4" 
      BeginProperty Font  
         Name            =   "Arial Rounded MT Bold" 
         Size            =   24 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFFFF& 
      Height          =   615 
      Index           =   3 
      Left            =   3600 
      TabIndex        =   7 
      Top             =   4920 
      Width           =   735 
   End 
   Begin VB.Shape Light  
      FillStyle       =   0  'Solid 
      Height          =   735 
      Index           =   3 
      Left            =   3600 
      Shape           =   3  'Circle 
      Top             =   1440 
      Width           =   735 
   End 
   Begin VB.Label Label  
      Alignment       =   2  'Center 
      BackStyle       =   0  'Transparent 
      Caption         =   "3" 
      BeginProperty Font  
         Name            =   "Arial Rounded MT Bold" 
         Size            =   24 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFFFF& 
      Height          =   615 
      Index           =   2 
      Left            =   2640 
      TabIndex        =   5 
      Top             =   4920 
      Width           =   735 
   End 
   Begin VB.Shape Light  
      FillColor       =   &H0000FFFF& 
      FillStyle       =   0  'Solid 
      Height          =   735 
      Index           =   2 
      Left            =   2640 
      Shape           =   3  'Circle 
      Top             =   1440 
      Width           =   735 
   End 
   Begin VB.Label Label  
      Alignment       =   2  'Center 
      BackStyle       =   0  'Transparent 
      Caption         =   "2" 
      BeginProperty Font  
         Name            =   "Arial Rounded MT Bold" 
         Size            =   24 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFFFF& 
      Height          =   615 
      Index           =   1 
      Left            =   1680 
      TabIndex        =   3 
      Top             =   4920 
      Width           =   735 
   End 
   Begin VB.Shape Light  
      FillColor       =   &H00C0FFFF& 
      FillStyle       =   0  'Solid 
      Height          =   735 
      Index           =   1 
      Left            =   1680 
      Shape           =   3  'Circle 
      Top             =   1440 
      Width           =   735 
   End 
   Begin VB.Label Label  
      Alignment       =   2  'Center 
      BackStyle       =   0  'Transparent 
      Caption         =   "1" 
      BeginProperty Font  
         Name            =   "Arial Rounded MT Bold" 
         Size            =   24 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFFFF& 
      Height          =   615 
      Index           =   0 
      Left            =   720 
      TabIndex        =   1 
      Top             =   4920 
      Width           =   735 
   End 
   Begin VB.Shape Light  
      FillColor       =   &H0000FFFF& 
      FillStyle       =   0  'Solid 
      Height          =   735 
      Index           =   0 
      Left            =   720 
      Shape           =   3  'Circle 
      Top             =   1440 
      Width           =   735 
   End 
End 
Attribute VB_Name = "DisplayWindow" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim Value(6) As Byte 
Public Sub Form_Load() 
' Initialize the display 
For i% = 0 To 6 
    Slider(6 - i%).Value = 255 / (i% + 1) 
    Call Slider_Change(i%) 
    Next i% 
End Sub 
Private Sub Slider_Change(index As Integer) 
If index <> 6 Then 
    Value(index) = Slider(index).Value * (Slider(6).Value / 255) 
    Light(index).FillColor = RGB(Value(index), Value(index), 0) 
    Else ' Master slider operated 
    For i% = 0 To 5: Call Slider_Change(i%): Next i% 
    End If 
' Mimic all changes to the real hardware 
Call WriteUSBdevice(AddressFor(Value(0)), 6) 
End Sub