home *** CD-ROM | disk | FTP | other *** search
/ CD Direkt 1995 #1 / Image.iso / cdd / source / vbsource / scgdem / accmove.frm (.txt) next >
Encoding:
Visual Basic Form  |  1993-09-27  |  5.2 KB  |  157 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. Option Explicit
  116. Dim WereMoving As Integer     ' record MouseDown/Up events
  117. Dim StartX, StartY As Single  ' mouse location at the start of a move
  118. Sub ByInk_Click ()
  119.     pentagon.SelectByInk = True
  120. End Sub
  121. Sub ByRect_Click ()
  122.     pentagon.SelectByInk = False
  123. End Sub
  124. Sub Empty_Click ()
  125.     pentagon.FillPattern = 1   ' Clear fill pattern
  126. End Sub
  127. Sub Filled_Click ()
  128.     pentagon.FillPattern = 16  ' graduated vertical
  129. End Sub
  130. Sub Form_Load ()
  131.     WereMoving = False   ' the mouse is up to begin with
  132. End Sub
  133. Sub pentagon_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  134.     ' record the MouseDown so MouseMove updates the shape
  135.     WereMoving = True
  136.     ' record the starting mouse position so we can move relative to that spot
  137.     ' this is described in the VB3 manual on p. 283
  138.     StartX = X
  139.     StartY = Y
  140.     ' use transparent shapes for faster redraw during mouse move
  141.     ' we'll turn gradfills back on in MouseUp
  142.     pentagon.ShowOutlineOnly = True
  143. End Sub
  144. Sub pentagon_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  145.     ' a MouseDown event sets the WereMoving flag
  146.     If WereMoving Then
  147.         ' redraw the shape at the current mouse position
  148.         pentagon.Move pentagon.Left + X - StartX, pentagon.Top + Y - StartY
  149.     End If
  150. End Sub
  151. Sub pentagon_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  152.     ' we finished a move so turn fills back on
  153.     pentagon.ShowOutlineOnly = False
  154.     ' we aren't moving until we get another MouseDown
  155.     WereMoving = False
  156. End Sub
  157.