home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / PGUIDE / VCR / VCR.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-16  |  18.7 KB  |  600 lines

  1. VERSION 5.00
  2. Begin VB.Form frmVCR 
  3.    BackColor       =   &H00000000&
  4.    Caption         =   "VBTV"
  5.    ClientHeight    =   7125
  6.    ClientLeft      =   1170
  7.    ClientTop       =   1470
  8.    ClientWidth     =   7110
  9.    FillStyle       =   0  'Solid
  10.    Icon            =   "vcr.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   7125
  14.    ScaleWidth      =   7110
  15.    Begin VB.CommandButton cmdSet 
  16.       Caption         =   "Set"
  17.       BeginProperty Font 
  18.          Name            =   "MS Sans Serif"
  19.          Size            =   8.25
  20.          Charset         =   0
  21.          Weight          =   700
  22.          Underline       =   0   'False
  23.          Italic          =   0   'False
  24.          Strikethrough   =   0   'False
  25.       EndProperty
  26.       Height          =   360
  27.       Left            =   4560
  28.       MaskColor       =   &H00000000&
  29.       TabIndex        =   13
  30.       ToolTipText     =   "Set the Timer for Recording"
  31.       Top             =   6000
  32.       Width           =   855
  33.    End
  34.    Begin VB.Timer tmr2 
  35.       Enabled         =   0   'False
  36.       Left            =   6240
  37.       Top             =   3240
  38.    End
  39.    Begin VB.Timer tmr1 
  40.       Interval        =   65535
  41.       Left            =   6240
  42.       Top             =   2640
  43.    End
  44.    Begin VB.CommandButton cmdDown 
  45.       Caption         =   "Down"
  46.       Height          =   325
  47.       Left            =   6120
  48.       MaskColor       =   &H00000000&
  49.       TabIndex        =   11
  50.       ToolTipText     =   "Channel selector"
  51.       Top             =   1440
  52.       Width           =   735
  53.    End
  54.    Begin VB.CommandButton cmdUp 
  55.       Caption         =   "Up"
  56.       Height          =   325
  57.       Left            =   6120
  58.       MaskColor       =   &H00000000&
  59.       TabIndex        =   10
  60.       ToolTipText     =   "Channel selector"
  61.       Top             =   1080
  62.       Width           =   735
  63.    End
  64.    Begin VB.CommandButton cmdExit 
  65.       Cancel          =   -1  'True
  66.       Caption         =   "Eject"
  67.       BeginProperty Font 
  68.          Name            =   "MS Sans Serif"
  69.          Size            =   8.25
  70.          Charset         =   0
  71.          Weight          =   700
  72.          Underline       =   0   'False
  73.          Italic          =   0   'False
  74.          Strikethrough   =   0   'False
  75.       EndProperty
  76.       Height          =   360
  77.       Left            =   5760
  78.       MaskColor       =   &H00000000&
  79.       TabIndex        =   7
  80.       ToolTipText     =   "Exit VBTV"
  81.       Top             =   6000
  82.       Width           =   1095
  83.    End
  84.    Begin VB.CommandButton cmdPause 
  85.       Caption         =   "ll"
  86.       Enabled         =   0   'False
  87.       BeginProperty Font 
  88.          Name            =   "MS Sans Serif"
  89.          Size            =   13.5
  90.          Charset         =   0
  91.          Weight          =   700
  92.          Underline       =   0   'False
  93.          Italic          =   0   'False
  94.          Strikethrough   =   0   'False
  95.       EndProperty
  96.       Height          =   360
  97.       Left            =   1005
  98.       MaskColor       =   &H00000000&
  99.       TabIndex        =   6
  100.       ToolTipText     =   "Pause"
  101.       Top             =   6000
  102.       Width           =   615
  103.    End
  104.    Begin VB.CommandButton cmdRec 
  105.       Caption         =   "Rec"
  106.       BeginProperty Font 
  107.          Name            =   "MS Sans Serif"
  108.          Size            =   8.25
  109.          Charset         =   0
  110.          Weight          =   700
  111.          Underline       =   0   'False
  112.          Italic          =   0   'False
  113.          Strikethrough   =   0   'False
  114.       EndProperty
  115.       Height          =   360
  116.       Left            =   1650
  117.       MaskColor       =   &H00000000&
  118.       TabIndex        =   5
  119.       ToolTipText     =   "Record"
  120.       Top             =   6000
  121.       Width           =   615
  122.    End
  123.    Begin VB.CommandButton cmdForward 
  124.       Caption         =   ">>"
  125.       BeginProperty Font 
  126.          Name            =   "MS Sans Serif"
  127.          Size            =   13.5
  128.          Charset         =   0
  129.          Weight          =   700
  130.          Underline       =   0   'False
  131.          Italic          =   0   'False
  132.          Strikethrough   =   0   'False
  133.       EndProperty
  134.       Height          =   360
  135.       Left            =   2955
  136.       MaskColor       =   &H00000000&
  137.       TabIndex        =   4
  138.       ToolTipText     =   "Fast Forward"
  139.       Top             =   6000
  140.       Width           =   615
  141.    End
  142.    Begin VB.CommandButton cmdRewind 
  143.       Caption         =   "<<"
  144.       BeginProperty Font 
  145.          Name            =   "MS Sans Serif"
  146.          Size            =   13.5
  147.          Charset         =   0
  148.          Weight          =   700
  149.          Underline       =   0   'False
  150.          Italic          =   0   'False
  151.          Strikethrough   =   0   'False
  152.       EndProperty
  153.       Height          =   360
  154.       Left            =   2310
  155.       MaskColor       =   &H00000000&
  156.       TabIndex        =   3
  157.       ToolTipText     =   "Rewind"
  158.       Top             =   6000
  159.       Width           =   615
  160.    End
  161.    Begin VB.CommandButton cmdStop 
  162.       Caption         =   "Stop"
  163.       Enabled         =   0   'False
  164.       BeginProperty Font 
  165.          Name            =   "MS Sans Serif"
  166.          Size            =   8.25
  167.          Charset         =   0
  168.          Weight          =   700
  169.          Underline       =   0   'False
  170.          Italic          =   0   'False
  171.          Strikethrough   =   0   'False
  172.       EndProperty
  173.       Height          =   360
  174.       Left            =   3600
  175.       MaskColor       =   &H00000000&
  176.       TabIndex        =   2
  177.       ToolTipText     =   "Stop"
  178.       Top             =   6000
  179.       Width           =   615
  180.    End
  181.    Begin VB.PictureBox picTV 
  182.       AutoRedraw      =   -1  'True
  183.       BackColor       =   &H00C0C0C0&
  184.       BorderStyle     =   0  'None
  185.       FillStyle       =   2  'Horizontal Line
  186.       BeginProperty Font 
  187.          Name            =   "MS Sans Serif"
  188.          Size            =   18
  189.          Charset         =   0
  190.          Weight          =   700
  191.          Underline       =   0   'False
  192.          Italic          =   0   'False
  193.          Strikethrough   =   0   'False
  194.       EndProperty
  195.       ForeColor       =   &H00FFFFFF&
  196.       Height          =   4215
  197.       Left            =   360
  198.       ScaleHeight     =   4215
  199.       ScaleWidth      =   5535
  200.       TabIndex        =   1
  201.       Top             =   240
  202.       Width           =   5535
  203.    End
  204.    Begin VB.CommandButton cmdPlay 
  205.       Caption         =   ">"
  206.       BeginProperty Font 
  207.          Name            =   "MS Sans Serif"
  208.          Size            =   13.5
  209.          Charset         =   0
  210.          Weight          =   700
  211.          Underline       =   0   'False
  212.          Italic          =   0   'False
  213.          Strikethrough   =   0   'False
  214.       EndProperty
  215.       Height          =   360
  216.       Left            =   360
  217.       MaskColor       =   &H00000000&
  218.       TabIndex        =   0
  219.       ToolTipText     =   "Play"
  220.       Top             =   6000
  221.       Width           =   615
  222.    End
  223.    Begin VB.Line Line2 
  224.       BorderColor     =   &H00808080&
  225.       X1              =   0
  226.       X2              =   7080
  227.       Y1              =   4660
  228.       Y2              =   4660
  229.    End
  230.    Begin VB.Line Line1 
  231.       BorderColor     =   &H00FFFFFF&
  232.       X1              =   0
  233.       X2              =   7080
  234.       Y1              =   4700
  235.       Y2              =   4700
  236.    End
  237.    Begin VB.Shape shpPlay 
  238.       FillColor       =   &H0000FF00&
  239.       FillStyle       =   0  'Solid
  240.       Height          =   105
  241.       Left            =   615
  242.       Shape           =   3  'Circle
  243.       Top             =   5835
  244.       Visible         =   0   'False
  245.       Width           =   105
  246.    End
  247.    Begin VB.Shape shpForward 
  248.       FillColor       =   &H0000FF00&
  249.       FillStyle       =   0  'Solid
  250.       Height          =   105
  251.       Left            =   3210
  252.       Shape           =   3  'Circle
  253.       Top             =   5835
  254.       Visible         =   0   'False
  255.       Width           =   105
  256.    End
  257.    Begin VB.Shape shpRewind 
  258.       FillColor       =   &H0000FF00&
  259.       FillStyle       =   0  'Solid
  260.       Height          =   105
  261.       Left            =   2565
  262.       Shape           =   3  'Circle
  263.       Top             =   5835
  264.       Visible         =   0   'False
  265.       Width           =   105
  266.    End
  267.    Begin VB.Shape shpRec 
  268.       FillColor       =   &H000000FF&
  269.       FillStyle       =   0  'Solid
  270.       Height          =   105
  271.       Left            =   1905
  272.       Shape           =   3  'Circle
  273.       Top             =   5835
  274.       Visible         =   0   'False
  275.       Width           =   105
  276.    End
  277.    Begin VB.Shape shpPause 
  278.       FillColor       =   &H0000FF00&
  279.       FillStyle       =   0  'Solid
  280.       Height          =   105
  281.       Left            =   1260
  282.       Shape           =   3  'Circle
  283.       Top             =   5835
  284.       Visible         =   0   'False
  285.       Width           =   105
  286.    End
  287.    Begin VB.Image img2 
  288.       Height          =   1155
  289.       Left            =   1680
  290.       Picture         =   "vcr.frx":0442
  291.       Top             =   6720
  292.       Visible         =   0   'False
  293.       Width           =   1155
  294.    End
  295.    Begin VB.Image img1 
  296.       Height          =   1155
  297.       Left            =   240
  298.       Picture         =   "vcr.frx":10CC
  299.       Top             =   6720
  300.       Visible         =   0   'False
  301.       Width           =   1155
  302.    End
  303.    Begin VB.Label lblTime 
  304.       Alignment       =   2  'Center
  305.       BackColor       =   &H00000000&
  306.       BorderStyle     =   1  'Fixed Single
  307.       BeginProperty Font 
  308.          Name            =   "MS Sans Serif"
  309.          Size            =   18
  310.          Charset         =   0
  311.          Weight          =   700
  312.          Underline       =   0   'False
  313.          Italic          =   0   'False
  314.          Strikethrough   =   0   'False
  315.       EndProperty
  316.       ForeColor       =   &H000000FF&
  317.       Height          =   615
  318.       Left            =   480
  319.       TabIndex        =   12
  320.       Top             =   4920
  321.       Width           =   1935
  322.    End
  323.    Begin VB.Label lblBrand 
  324.       BackStyle       =   0  'Transparent
  325.       Caption         =   "Microsoft Visual Basic VCR - Version 1.0"
  326.       ForeColor       =   &H00FFFFFF&
  327.       Height          =   375
  328.       Left            =   3360
  329.       TabIndex        =   9
  330.       Top             =   5160
  331.       Width           =   2895
  332.    End
  333.    Begin VB.Image imgTapeSlot 
  334.       BorderStyle     =   1  'Fixed Single
  335.       Height          =   735
  336.       Left            =   2640
  337.       Top             =   4920
  338.       Width           =   4215
  339.    End
  340.    Begin VB.Label lblChannel 
  341.       Alignment       =   2  'Center
  342.       BackStyle       =   0  'Transparent
  343.       BorderStyle     =   1  'Fixed Single
  344.       Caption         =   "3"
  345.       BeginProperty Font 
  346.          Name            =   "MS Sans Serif"
  347.          Size            =   24
  348.          Charset         =   0
  349.          Weight          =   700
  350.          Underline       =   0   'False
  351.          Italic          =   0   'False
  352.          Strikethrough   =   0   'False
  353.       EndProperty
  354.       ForeColor       =   &H0000FF00&
  355.       Height          =   615
  356.       Left            =   6120
  357.       TabIndex        =   8
  358.       ToolTipText     =   "Channel display"
  359.       Top             =   240
  360.       Width           =   735
  361.    End
  362. Attribute VB_Name = "frmVCR"
  363. Attribute VB_Base = "0{FF90640B-E9E1-11CF-84BA-00AA00C007F0}"
  364. Attribute VB_GlobalNameSpace = False
  365. Attribute VB_Creatable = False
  366. Attribute VB_TemplateDerived = False
  367. Attribute VB_PredeclaredId = True
  368. Attribute VB_Exposed = False
  369. '**********************************************
  370. ' Purpose:  Main form for the VCR sample
  371. ' application. Emulates a video cassette
  372. ' recorder using Visual Basic objects.
  373. '**********************************************
  374. Option Explicit
  375. ' Create an instance of the Tape class
  376. Dim Tape As New clsTape
  377. Dim vntChannel As Variant   'Channel number
  378. ' Constants for QBColor function
  379. Const vcrBlack = 0
  380. Const vcrGreen = 2
  381. Const vcrCyan = 3
  382. Const vcrRed = 4
  383. Const vcrMagenta = 5
  384. Const vcrYellow = 6
  385. Const vcrWhite = 7
  386. Const vcrGray = 8
  387. Const vcrLightBlue = 9
  388. Const vcrLightGreen = 10
  389. Const vcrLightCyan = 11
  390. Const vcrLightRed = 12
  391. Const vcrLightMagenta = 13
  392. Private Sub cmdDown_Click()
  393.     ' if in range, set the channel number
  394.     If vntChannel > 2 Then
  395.         vntChannel = vntChannel - 1
  396.     Else
  397.         vntChannel = 13
  398.     End If
  399.     ' assign the channel variable to the display
  400.     lblChannel.Caption = vntChannel
  401. End Sub
  402. Private Sub cmdExit_Click()
  403.     ' unload the form, release the reference
  404.     Unload Me
  405.     Set frmVCR = Nothing
  406. End Sub
  407. Private Sub cmdForward_Click()
  408.     ' call the function to save the old channel
  409.     SaveChannel vntChannel
  410.     ' must be on channel 3 to play a tape
  411.     vntChannel = 3
  412.     lblChannel.Caption = vntChannel
  413.     ' Set the properties of the Tape class
  414.     Tape.Forward = True
  415.     Tape.Speed = 50
  416.     ' Start the timer
  417.     tmr2.Enabled = True
  418.     tmr2.Interval = Tape.Speed
  419.     ' Call the function to update the controls
  420.     ButtonManager frmVCR.cmdForward
  421. End Sub
  422. Private Sub cmdPause_Click()
  423.     ' Stop the timer
  424.     tmr2.Enabled = False
  425.     ' Call the function to update the controls
  426.     ButtonManager frmVCR.cmdPause
  427. End Sub
  428. Private Sub cmdPlay_Click()
  429.     ' call the function to save the old channel
  430.     SaveChannel vntChannel
  431.     ' must be on channel 3 to play a tape
  432.     vntChannel = 3
  433.     lblChannel.Caption = vntChannel
  434.     ' Set the properties of the Tape class
  435.     Tape.Forward = True
  436.     Tape.Speed = 300
  437.     ' Start the timer
  438.     tmr2.Enabled = True
  439.     tmr2.Interval = Tape.Speed
  440.     ' Call the function to update the controls
  441.     ButtonManager frmVCR.cmdPlay
  442. End Sub
  443. Private Sub cmdRec_Click()
  444.     Dim strStatus As String     'Display text
  445.     ' call the function to save the old channel
  446.     SaveChannel vntChannel
  447.     ' Clear the display
  448.     picTV.Cls
  449.     ' Diplay the status
  450.     strStatus = "Recording: Channel " & vntChannel
  451.     picTV.Print strStatus
  452.     strStatus = lblTime.Caption
  453.     picTV.Print strStatus
  454.     ' Call the function to update the controls
  455.     ButtonManager frmVCR.cmdRec
  456. End Sub
  457. Private Sub cmdRewind_Click()
  458.     ' call the function to save the old channel
  459.     SaveChannel vntChannel
  460.     ' must be on channel 3 to play a tape
  461.     vntChannel = 3
  462.     lblChannel.Caption = vntChannel
  463.     ' Set the properties of the Tape class
  464.     Tape.Forward = False
  465.     Tape.Speed = 50
  466.     ' Start the timer
  467.     tmr2.Enabled = True
  468.     tmr2.Interval = Tape.Speed
  469.     ' Call the function to update the controls
  470.     ButtonManager frmVCR.cmdRewind
  471. End Sub
  472. Private Sub cmdSet_Click()
  473.     ' show the user entry form modally
  474.     frmSetTime.Show vbModal
  475. End Sub
  476. Private Sub cmdStop_Click()
  477.     Dim intChannel As Integer   'Channel number
  478.     ' Stop the timer
  479.     tmr2.Enabled = False
  480.     ' Call the function to update the controls
  481.     ButtonManager frmVCR.cmdStop
  482.     ' Clear the display
  483.     picTV.Cls
  484.     ' restore the old channel
  485.     intChannel = SaveChannel(0)
  486.     vntChannel = intChannel
  487.     lblChannel.Caption = vntChannel
  488. End Sub
  489. Private Sub cmdUp_Click()
  490.     ' if in range, set the channel number
  491.     If vntChannel < 13 Then
  492.         vntChannel = vntChannel + 1
  493.     Else
  494.         vntChannel = 2
  495.     End If
  496.      ' assign the channel variable to the display
  497.      lblChannel.Caption = vntChannel
  498. End Sub
  499. Private Sub Form_Load()
  500.     ' Show the current time
  501.     lblTime.Caption = Format((Now), "h:mm AM/PM")
  502.     ' Set the height of the form
  503.     frmVCR.Height = 6990
  504.     img1.Visible = True
  505.     ' Display the form
  506.     Me.Show
  507.     ' set the initial channel
  508.     vntChannel = 3
  509.     lblChannel.Caption = vntChannel
  510. End Sub
  511. Private Sub Form_Unload(Cancel As Integer)
  512.     ' Release the references
  513.     Set Tape = Nothing
  514.     Set Recorder = Nothing
  515.     Set frmVCR = Nothing
  516. End Sub
  517. Private Sub lblChannel_Change()
  518.     ' Change the display color based on channel
  519.     Select Case vntChannel
  520.         Case 2
  521.             picTV.BackColor = QBColor(vcrGreen)
  522.         Case 3
  523.             picTV.BackColor = QBColor(vcrWhite)
  524.         Case 4
  525.             picTV.BackColor = QBColor(vcrRed)
  526.         Case 5
  527.             picTV.BackColor = QBColor(vcrMagenta)
  528.         Case 6
  529.             picTV.BackColor = QBColor(vcrYellow)
  530.         Case 7
  531.             picTV.BackColor = QBColor(vcrCyan)
  532.         Case 8
  533.             picTV.BackColor = QBColor(vcrGray)
  534.         Case 9
  535.             picTV.BackColor = QBColor(vcrLightBlue)
  536.         Case 10
  537.             picTV.BackColor = QBColor(vcrLightGreen)
  538.         Case 11
  539.             picTV.BackColor = QBColor(vcrLightCyan)
  540.         Case 12
  541.             picTV.BackColor = QBColor(vcrLightRed)
  542.         Case 13
  543.             picTV.BackColor = QBColor(vcrLightMagenta)
  544.     End Select
  545.     ' Clear the display
  546.     picTV.Cls
  547.     ' Display the channel & time
  548.     picTV.Print "Channel: " & vntChannel
  549.     picTV.Print lblTime.Caption
  550. End Sub
  551. Private Sub tmr1_Timer()
  552.     ' Update the time display
  553.     lblTime.Caption = Format((Now), "h:mm AM/PM")
  554.     ' If the Recorder property is turned on
  555.     If Recorder.Enabled = True Then
  556.         ' If it's time to record
  557.         If Recorder.StartRecording = lblTime.Caption Then
  558.             ' Start "recording"
  559.             vntChannel = Recorder.Channel
  560.             lblChannel.Caption = vntChannel
  561.             ' Activate the Record button
  562.             cmdRec.Value = True
  563.             ' clear the property in the Recorder class
  564.             Recorder.StartRecording = Empty
  565.         End If
  566.     Else
  567.         ' If it's time to stop recording
  568.         If Recorder.StopRecording = lblTime.Caption Then
  569.             ' Activate the Stop button
  570.             cmdStop.Value = True
  571.             ' clear the property in the Recorder class
  572.             Recorder.StopRecording = Empty
  573.         End If
  574.     End If
  575. End Sub
  576. Private Sub tmr2_Timer()
  577.     Dim intWidth As Integer     'Width value
  578.     Dim intLeft As Integer      'Left value
  579.     Dim objImage As Control     'Image control
  580.     ' Get the width of the display
  581.     intWidth = picTV.Width
  582.     ' Call the method in the Tape class
  583.     ' to "play" the tape.
  584.     Tape.Animate intWidth
  585.     ' Retrieve the Left property from the class
  586.     intLeft = Tape.Left
  587.     ' Show either the first or second image
  588.     If img1.Visible = True Then
  589.         img1.Visible = False
  590.         Set objImage = img2
  591.     Else
  592.         img1.Visible = True
  593.         Set objImage = img1
  594.     End If
  595.     ' Clear the display
  596.     picTV.Cls
  597.     ' Show the new image in the new location
  598.     picTV.PaintPicture objImage.Picture, intLeft, 1200
  599. End Sub
  600.