home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch28code / quadtest.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-31  |  3.0 KB  |  95 lines

  1. VERSION 4.00
  2. Begin VB.Form frmQuadTest 
  3.    Caption         =   "Quadrants ModuleTester"
  4.    ClientHeight    =   6165
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1515
  7.    ClientWidth     =   7950
  8.    Height          =   6570
  9.    Left            =   1080
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    ScaleHeight     =   6165
  13.    ScaleWidth      =   7950
  14.    Tag             =   "Quadrants ModuleTester"
  15.    Top             =   1170
  16.    Width           =   8070
  17.    Begin VB.PictureBox Picture1 
  18.       Appearance      =   0  'Flat
  19.       BackColor       =   &H80000005&
  20.       ForeColor       =   &H80000008&
  21.       Height          =   750
  22.       Left            =   840
  23.       ScaleHeight     =   720
  24.       ScaleWidth      =   2295
  25.       TabIndex        =   0
  26.       Top             =   735
  27.       Width           =   2325
  28.    End
  29. Attribute VB_Name = "frmQuadTest"
  30. Attribute VB_Creatable = False
  31. Attribute VB_Exposed = False
  32. Option Explicit
  33. Private Sub Form_Click()
  34.     If Caption = "Click Me!" Then
  35.         MsgBox "Buttons?  We don't need no stinking buttons!.", vbInformation
  36.     End If
  37. End Sub
  38. Private Sub Form_Load()
  39. Dim r As RECT
  40.     AutoRedraw = True
  41.     Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
  42.     ' Create a 3D grid with four quadrants on the form.
  43.     Draw3DGrid Me, True
  44.     ' Create PictureBox button
  45.     With Picture1
  46.         GetQuad 1, r
  47.         SizeToRectClient Picture1, r
  48.         .AutoRedraw = True
  49.         .ScaleMode = vbPixels
  50.         .BackColor = BackColor
  51.         .BorderStyle = 0
  52.         Draw3DPicBorder Picture1, False
  53.     End With
  54.     ' Draw a purple rectangle in the second quadrant.
  55.     GetQuad 2, r
  56.     ResizeRect r, -2, -2, False
  57.     DrawRect Me, r, True, RGB(64, 0, 128)
  58. End Sub
  59. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  60. Dim r As RECT
  61.     If Caption = "Click Me!" Then
  62.         GetQuad 2, r
  63.         ResizeRect r, -2, -2, False
  64.         DrawMode = 6
  65.         DrawRect Me, r, True, Point(X, Y)
  66.         DrawMode = 13
  67.     End If
  68. End Sub
  69. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  70. Dim pt As PointAPI, r As RECT
  71.     pt.X = X
  72.     pt.Y = Y
  73.     GetQuad 2, r
  74. #If Win32 Then
  75.     Caption = IIf(PtInRect(r, pt.X, pt.Y), "Click Me!", Tag)
  76. #Else
  77.     Caption = IIf(PtInRect(r, pt.Y, pt.X), "Click Me!", Tag)
  78. #End If
  79. End Sub
  80. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  81. Dim r As RECT
  82.     GetQuad 2, r
  83.     ResizeRect r, -2, -2, False
  84.     DrawRect Me, r, True, RGB(64, 0, 128)
  85. End Sub
  86. Private Sub Picture1_Click()
  87.     MsgBox "Click events only occur when the MouseUp event occurs over the control.", vbInformation
  88. End Sub
  89. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  90.     Draw3DPicBorder Picture1, True
  91. End Sub
  92. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  93.     Draw3DPicBorder Picture1, False
  94. End Sub
  95.