home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / bitvctr / bitvectr.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-04  |  3.6 KB  |  127 lines

  1. VERSION 4.00
  2. Begin VB.Form frmBitVectorTest 
  3.    Caption         =   "BitVector Class Test"
  4.    ClientHeight    =   4455
  5.    ClientLeft      =   1245
  6.    ClientTop       =   1635
  7.    ClientWidth     =   5715
  8.    Height          =   4920
  9.    Left            =   1155
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   297
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   381
  14.    Top             =   1260
  15.    Width           =   5895
  16.    Begin VB.Timer Timer1 
  17.       Interval        =   55
  18.       Left            =   4860
  19.       Top             =   1650
  20.    End
  21.    Begin VB.CommandButton cmdTest3 
  22.       Caption         =   "Test &3"
  23.       Height          =   405
  24.       Left            =   4290
  25.       TabIndex        =   2
  26.       Top             =   1170
  27.       Width           =   1215
  28.    End
  29.    Begin VB.CommandButton cmdTest2 
  30.       Caption         =   "Test &2"
  31.       Height          =   405
  32.       Left            =   4290
  33.       TabIndex        =   1
  34.       Top             =   690
  35.       Width           =   1215
  36.    End
  37.    Begin VB.CommandButton cmdTest1 
  38.       Caption         =   "Test &1"
  39.       Height          =   405
  40.       Left            =   4290
  41.       TabIndex        =   0
  42.       Top             =   210
  43.       Width           =   1215
  44.    End
  45.    Begin VB.Image Image1 
  46.       Height          =   180
  47.       Index           =   1
  48.       Left            =   4860
  49.       Picture         =   "bitvectr.frx":0000
  50.       Top             =   2430
  51.       Visible         =   0   'False
  52.       Width           =   180
  53.    End
  54.    Begin VB.Image Image1 
  55.       Height          =   180
  56.       Index           =   0
  57.       Left            =   4620
  58.       Picture         =   "bitvectr.frx":00E2
  59.       Top             =   2430
  60.       Visible         =   0   'False
  61.       Width           =   180
  62.    End
  63. Attribute VB_Name = "frmBitVectorTest"
  64. Attribute VB_Creatable = False
  65. Attribute VB_Exposed = False
  66. ' BitVector Class Test App
  67. ' Copyright 
  68.  1995-1996 by Gregg S. Irwin. All Rights Reserved.
  69. DefInt A-Z
  70. Dim mTestMode As Integer
  71. Dim BV As New BitVector
  72. Private Sub cmdTest1_Click()
  73.     mTestMode = 1
  74.     Cls
  75.     BV.NumElements = 25000
  76.     BV.SetBit 12345
  77.     Print BV.IsBitSet(12345)
  78.     BV.ClearBit 12345
  79.     Print BV.IsBitSet(12345)
  80.     BV.ToggleBit 12345
  81.     Print BV.IsBitSet(12345)
  82.     BV.ToggleBit 12345
  83.     Print BV.IsBitSet(12345)
  84.     On Error GoTo Test1Err
  85.         BV.ToggleBit 25001
  86.     On Error GoTo 0
  87. Test1Exit:
  88.     Exit Sub
  89. Test1Err:
  90.     Print Err.Description, Err.Source
  91.     Resume Next
  92. End Sub
  93. Private Sub cmdTest2_Click()
  94.     mTestMode = 2
  95.     Cls
  96.     BV.NumElements = 4096
  97. End Sub
  98. Private Sub cmdTest3_Click()
  99.     mTestMode = 3
  100.     Cls
  101.     BV.NumElements = 256
  102. End Sub
  103. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  104.     Dim Row As Integer
  105.     Dim Col As Integer
  106.     Dim Index As Long
  107.     If mTestMode = 2 Then
  108.         Row = X \ 12
  109.         Col = Y \ 12
  110.         Index = Row * Col
  111.         BV.ToggleBit Index
  112.         PaintPicture Image1(BV.GetBit(Index)).Picture, Row * 12, Col * 12
  113.     End If
  114. End Sub
  115. Private Sub Form_Unload(Cancel As Integer)
  116.         
  117.     Set BV = Nothing
  118. End Sub
  119. Private Sub Timer1_Timer()
  120.     Dim Index As Long
  121.     If mTestMode = 3 Then
  122.         Index = CLng(Rnd * (BV.NumElements - 1))
  123.         BV.ToggleBit Index
  124.         PaintPicture Image1(BV.GetBit(Index)).Picture, (Index \ 16) * 12, (Index Mod 16) * 12
  125.     End If
  126. End Sub
  127.