home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vb017e / vb017ex.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  4.0 KB  |  125 lines

  1. VERSION 2.00
  2. Begin Form VBEX017 
  3.    Caption         =   "VISUAL BASICS #17 - Moving the Mouse"
  4.    ClientHeight    =   675
  5.    ClientLeft      =   1635
  6.    ClientTop       =   3375
  7.    ClientWidth     =   5100
  8.    Height          =   1080
  9.    Left            =   1575
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   675
  13.    ScaleWidth      =   5100
  14.    Top             =   3030
  15.    Width           =   5220
  16.    Begin CommandButton Command2 
  17.       Cancel          =   -1  'True
  18.       Caption         =   "Quit"
  19.       Height          =   375
  20.       Left            =   3840
  21.       TabIndex        =   3
  22.       Top             =   120
  23.       Width           =   975
  24.    End
  25.    Begin CommandButton Command1 
  26.       Caption         =   "Fast"
  27.       Default         =   -1  'True
  28.       Height          =   375
  29.       Index           =   2
  30.       Left            =   2640
  31.       TabIndex        =   2
  32.       Top             =   120
  33.       Width           =   975
  34.    End
  35.    Begin CommandButton Command1 
  36.       Caption         =   "Medium"
  37.       Height          =   375
  38.       Index           =   1
  39.       Left            =   1440
  40.       TabIndex        =   1
  41.       Top             =   120
  42.       Width           =   975
  43.    End
  44.    Begin CommandButton Command1 
  45.       Caption         =   "Slow"
  46.       Height          =   375
  47.       Index           =   0
  48.       Left            =   240
  49.       TabIndex        =   0
  50.       Top             =   120
  51.       Width           =   975
  52.    End
  53. Sub Command1_Click (Index As Integer)
  54.        
  55.     Speed% = (Index * 10) + 1 ' INDEX SETS THE SPEED OF THE MOUSE.
  56.                               ' the higher the index, the fewer the
  57.                               ' DoEvents() calls, hence the higher the speed.
  58.                               ' We add one to avoid a DIVIDE BY ZERO error.
  59.     'RESTORES CURSOR TO FULL SCREEN
  60.     CursorRect.Top = 0
  61.     CursorRect.Left = 0
  62.     CursorRect.right = ScreenWidth
  63.     CursorRect.Bottom = ScreenHeight
  64.     ClipCursor CursorRect
  65.     SetCurSorPos 400, 300
  66.     For X% = 0 To ScreenWidth ' left to right
  67.         CursorRect.Top = 200
  68.         CursorRect.Left = X%
  69.         CursorRect.right = CursorRect.Left
  70.         CursorRect.Bottom = CursorRect.Top
  71.         ClipCursor CursorRect
  72.         SetCurSorPos 0, 0
  73.         If X% Mod Speed% = 0 Then D% = DoEvents()
  74.     Next X%
  75.         
  76.     For X% = ScreenWidth To 0 Step -1 'Right To Left
  77.         CursorRect.Top = 200
  78.         CursorRect.Left = X%
  79.         CursorRect.right = CursorRect.Left
  80.         CursorRect.Bottom = CursorRect.Top
  81.         ClipCursor CursorRect
  82.         SetCurSorPos 0, 0
  83.         If X% Mod Speed% = 0 Then D% = DoEvents()
  84.     Next X%
  85.     For Y% = 0 To ScreenHeight 'top to bottom
  86.         CursorRect.Top = Y%
  87.         CursorRect.Left = 250
  88.         CursorRect.right = CursorRect.Left
  89.         CursorRect.Bottom = CursorRect.Top
  90.         ClipCursor CursorRect
  91.         SetCurSorPos 0, 0
  92.         If X% Mod Speed% = 0 Then D% = DoEvents()
  93.     Next Y%
  94.     For Y% = ScreenHeight To 0 Step -1
  95.         CursorRect.Top = Y%
  96.         CursorRect.Left = 250
  97.         CursorRect.right = CursorRect.Left
  98.         CursorRect.Bottom = CursorRect.Top
  99.         ClipCursor CursorRect
  100.         SetCurSorPos 0, 0
  101.         If X% Mod Speed% = 0 Then D% = DoEvents()
  102.     Next Y%
  103.     CursorRect.Top = 0
  104.     CursorRect.Left = 0
  105.     CursorRect.right = ScreenWidth
  106.     CursorRect.Bottom = ScreenHeight
  107.     ClipCursor CursorRect
  108.     SetCurSorPos ScreenWidth / 2, ScreenHeight / 2
  109. End Sub
  110. Sub Command2_Click ()
  111.     CursorRect.Top = 0
  112.     CursorRect.Left = 0
  113.     CursorRect.right = screen.Width / 15
  114.     CursorRect.Bottom = screen.Height / 15
  115.     ClipCursor CursorRect
  116.     End
  117. End Sub
  118. Sub Form_Load ()
  119.     ScreenHeight = screen.Height / 15
  120.     ScreenWidth = screen.Width / 15
  121. End Sub
  122. Sub Form_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  123.     MousePressed = 0
  124. End Sub
  125.