home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code2 / scg_demo / accmove.frm next >
Text File  |  1993-09-27  |  5KB  |  167 lines

  1. VERSION 2.00
  2. Begin Form frmAccMove 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Accurate Move"
  5.    ClientHeight    =   5790
  6.    ClientLeft      =   2445
  7.    ClientTop       =   1485
  8.    ClientWidth     =   7365
  9.    ControlBox      =   0   'False
  10.    Height          =   6195
  11.    Left            =   2385
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5790
  16.    ScaleWidth      =   7365
  17.    Top             =   1140
  18.    Width           =   7485
  19.    Begin Frame FrameFill 
  20.       BackColor       =   &H00C0C0C0&
  21.       Caption         =   "Fill Pattern"
  22.       Height          =   1095
  23.       Left            =   4440
  24.       TabIndex        =   3
  25.       Top             =   3360
  26.       Width           =   2775
  27.       Begin OptionButton Empty 
  28.          BackColor       =   &H00C0C0C0&
  29.          Caption         =   "Transparent"
  30.          Height          =   255
  31.          Left            =   240
  32.          TabIndex        =   5
  33.          Top             =   360
  34.          Width           =   2295
  35.       End
  36.       Begin OptionButton Filled 
  37.          BackColor       =   &H00C0C0C0&
  38.          Caption         =   "Graduated Fill"
  39.          Height          =   255
  40.          Left            =   240
  41.          TabIndex        =   4
  42.          Top             =   720
  43.          Value           =   -1  'True
  44.          Width           =   2415
  45.       End
  46.    End
  47.    Begin Frame FrameSelect 
  48.       BackColor       =   &H00C0C0C0&
  49.       Caption         =   "Select By"
  50.       Height          =   1095
  51.       Left            =   4440
  52.       TabIndex        =   0
  53.       Top             =   4560
  54.       Width           =   2775
  55.       Begin OptionButton ByRect 
  56.          BackColor       =   &H00C0C0C0&
  57.          Caption         =   "Rectangular Area"
  58.          Height          =   255
  59.          Left            =   240
  60.          TabIndex        =   2
  61.          Top             =   720
  62.          Width           =   2415
  63.       End
  64.       Begin OptionButton ByInk 
  65.          BackColor       =   &H00C0C0C0&
  66.          Caption         =   "Ink"
  67.          Height          =   255
  68.          Left            =   240
  69.          TabIndex        =   1
  70.          Top             =   360
  71.          Value           =   -1  'True
  72.          Width           =   1095
  73.       End
  74.    End
  75.    Begin Label Label1 
  76.       BackStyle       =   0  'Transparent
  77.       Caption         =   "Try dragging the pentagon with different fill and selection options."
  78.       ForeColor       =   &H00FF0000&
  79.       Height          =   615
  80.       Left            =   4440
  81.       TabIndex        =   6
  82.       Top             =   2640
  83.       Width           =   2775
  84.       WordWrap        =   -1  'True
  85.    End
  86.    Begin SCGraphic pentagon 
  87.       AngleEnd        =   45
  88.       AngleStart      =   -90
  89.       ArrowSize       =   2  'Small
  90.       ArrowType       =   0  'None
  91.       DrawInside      =   0   'False
  92.       FillColor       =   &H00FF00FF&
  93.       FillColor2      =   &H0000FFFF&
  94.       FillPattern     =   16  'Graduated Vertical
  95.       Height          =   2415
  96.       InhibitEraseOnRedraw=   0   'False
  97.       Left            =   480
  98.       LineColor       =   &H00FF0000&
  99.       LinePattern     =   0  'Solid
  100.       LineWidth       =   50
  101.       MouseEvents     =   -1  'True
  102.       NumPoints       =   5
  103.       PaletteSteps    =   50
  104.       RoundRadius     =   0
  105.       SelectByInk     =   -1  'True
  106.       ShadowColor     =   &H00000000&
  107.       ShadowDepthX    =   0
  108.       ShadowDepthY    =   0
  109.       Shape           =   6  'Ngon
  110.       ShowOutlineOnly =   0   'False
  111.       Top             =   1560
  112.       Use256Palette   =   -1  'True
  113.       Width           =   3375
  114.    End
  115. End
  116. Option Explicit
  117. Dim WereMoving As Integer     ' record MouseDown/Up events
  118. Dim StartX, StartY As Single  ' mouse location at the start of a move
  119.  
  120. Sub ByInk_Click ()
  121.     pentagon.SelectByInk = True
  122. End Sub
  123.  
  124. Sub ByRect_Click ()
  125.     pentagon.SelectByInk = False
  126. End Sub
  127.  
  128. Sub Empty_Click ()
  129.     pentagon.FillPattern = 1   ' Clear fill pattern
  130. End Sub
  131.  
  132. Sub Filled_Click ()
  133.     pentagon.FillPattern = 16  ' graduated vertical
  134. End Sub
  135.  
  136. Sub Form_Load ()
  137.     WereMoving = False   ' the mouse is up to begin with
  138. End Sub
  139.  
  140. Sub pentagon_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  141.     ' record the MouseDown so MouseMove updates the shape
  142.     WereMoving = True
  143.     ' record the starting mouse position so we can move relative to that spot
  144.     ' this is described in the VB3 manual on p. 283
  145.     StartX = X
  146.     StartY = Y
  147.     ' use transparent shapes for faster redraw during mouse move
  148.     ' we'll turn gradfills back on in MouseUp
  149.     pentagon.ShowOutlineOnly = True
  150. End Sub
  151.  
  152. Sub pentagon_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  153.     ' a MouseDown event sets the WereMoving flag
  154.     If WereMoving Then
  155.         ' redraw the shape at the current mouse position
  156.         pentagon.Move pentagon.Left + X - StartX, pentagon.Top + Y - StartY
  157.     End If
  158. End Sub
  159.  
  160. Sub pentagon_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  161.     ' we finished a move so turn fills back on
  162.     pentagon.ShowOutlineOnly = False
  163.     ' we aren't moving until we get another MouseDown
  164.     WereMoving = False
  165. End Sub
  166.  
  167.