home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Delphi / PolarDraw / data1.cab / Samples / Visual_Basic / VBDraw / frmGrid.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-08-31  |  5.5 KB  |  186 lines

  1. VERSION 5.00
  2. Begin VB.Form frmGrid 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Grid settings"
  5.    ClientHeight    =   2115
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4740
  9.    Icon            =   "frmGrid.frx":0000
  10.    LinkTopic       =   "Form2"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   2115
  14.    ScaleWidth      =   4740
  15.    StartUpPosition =   1  'CenterOwner
  16.    Begin VB.TextBox txtVGrid 
  17.       BeginProperty DataFormat 
  18.          Type            =   1
  19.          Format          =   "0"
  20.          HaveTrueFalseNull=   0
  21.          FirstDayOfWeek  =   0
  22.          FirstWeekOfYear =   0
  23.          LCID            =   1033
  24.          SubFormatType   =   1
  25.       EndProperty
  26.       Height          =   285
  27.       Left            =   2535
  28.       TabIndex        =   3
  29.       Text            =   "2"
  30.       Top             =   930
  31.       Width           =   540
  32.    End
  33.    Begin VB.TextBox txtHGrid 
  34.       BeginProperty DataFormat 
  35.          Type            =   1
  36.          Format          =   "0"
  37.          HaveTrueFalseNull=   0
  38.          FirstDayOfWeek  =   0
  39.          FirstWeekOfYear =   0
  40.          LCID            =   1033
  41.          SubFormatType   =   1
  42.       EndProperty
  43.       Height          =   285
  44.       Left            =   2535
  45.       TabIndex        =   2
  46.       Text            =   "2"
  47.       Top             =   540
  48.       Width           =   540
  49.    End
  50.    Begin VB.CheckBox chckSnapToGrid 
  51.       Caption         =   "Align shapes to grid"
  52.       Height          =   360
  53.       Left            =   1740
  54.       TabIndex        =   4
  55.       Top             =   1440
  56.       Value           =   1  'Checked
  57.       Width           =   1800
  58.    End
  59.    Begin VB.CommandButton btnCancel 
  60.       Cancel          =   -1  'True
  61.       Caption         =   "Cancel"
  62.       Height          =   375
  63.       Left            =   3840
  64.       TabIndex        =   6
  65.       Top             =   585
  66.       Width           =   870
  67.    End
  68.    Begin VB.CommandButton btnOK 
  69.       Caption         =   "OK"
  70.       Height          =   375
  71.       Left            =   3825
  72.       TabIndex        =   5
  73.       Top             =   180
  74.       Width           =   870
  75.    End
  76.    Begin VB.CommandButton btnGridColor 
  77.       Caption         =   "Choose color..."
  78.       Height          =   360
  79.       Left            =   45
  80.       TabIndex        =   1
  81.       Top             =   795
  82.       Width           =   1320
  83.    End
  84.    Begin VB.CheckBox chckShowGrid 
  85.       Caption         =   "Show grid"
  86.       Height          =   360
  87.       Left            =   195
  88.       TabIndex        =   0
  89.       Top             =   195
  90.       Value           =   1  'Checked
  91.       Width           =   1245
  92.    End
  93.    Begin VB.Frame Frame1 
  94.       Caption         =   "Grid units: milimeters"
  95.       Height          =   1680
  96.       Left            =   1650
  97.       TabIndex        =   7
  98.       Top             =   195
  99.       Width           =   1935
  100.       Begin VB.Label lblVGrid 
  101.          Caption         =   "&Height:"
  102.          Height          =   240
  103.          Left            =   105
  104.          TabIndex        =   9
  105.          Top             =   750
  106.          Width           =   705
  107.       End
  108.       Begin VB.Label lblHGrid 
  109.          Caption         =   "&Width:"
  110.          Height          =   240
  111.          Left            =   120
  112.          TabIndex        =   8
  113.          Top             =   375
  114.          Width           =   705
  115.       End
  116.    End
  117. Attribute VB_Name = "frmGrid"
  118. Attribute VB_GlobalNameSpace = False
  119. Attribute VB_Creatable = False
  120. Attribute VB_PredeclaredId = True
  121. Attribute VB_Exposed = False
  122. Dim crGridColor As OLE_COLOR
  123. Dim lGridHeight, lGridWidth As Long
  124. Dim fSnapToGrid, fShowGrid As Boolean
  125. Private Sub btnCancel_Click()
  126. 'if user cancels, set back to initial values
  127.    With pd_Environment
  128.         .ShowGrid = fShowGrid
  129.         .SnapToGrid = fSnapToGrid
  130.     End With
  131.     With pd_Page
  132.         .VerticalGrid = lGridHeight
  133.         .HorizontalGrid = lGridWidth
  134.         .GridColor = crGridColor
  135.     End With
  136.     Unload Me
  137. End Sub
  138. Private Sub btnGridColor_Click()
  139.     With pd_Page
  140.         .GridColor = SetColor(.GridColor)
  141.     End With
  142. End Sub
  143. Private Sub btnOK_Click()
  144.     Unload Me
  145. End Sub
  146. Private Sub chckShowGrid_Click()
  147.     pd_Environment.ShowGrid = CBool(chckShowGrid.Value)
  148.     If (CBool(chckShowGrid.Value)) Then
  149.       txtHGrid.Enabled = True
  150.       txtVGrid.Enabled = True
  151.       btnGridColor.Enabled = True
  152.       chckSnapToGrid.Enabled = True
  153.     Else
  154.       txtHGrid.Enabled = False
  155.       txtVGrid.Enabled = False
  156.       btnGridColor.Enabled = False
  157.       chckSnapToGrid.Enabled = False
  158.    End If
  159. End Sub
  160. Private Sub chckSnapToGrid_Click()
  161.     pd_Environment.SnapToGrid = CBool(chckSnapToGrid.Value)
  162. End Sub
  163. Private Sub Form_Load()
  164.     'saving initial values
  165.     With pd_Environment
  166.         fShowGrid = .ShowGrid
  167.         fSnapToGrid = .SnapToGrid
  168.     End With
  169.     With pd_Page
  170.         lGridHeight = .VerticalGrid
  171.         lGridWidth = .HorizontalGrid
  172.         crGridColor = .GridColor
  173.     End With
  174.      
  175.     chckShowGrid.Value = Abs(fShowGrid)
  176.     chckSnapToGrid.Value = Abs(fSnapToGrid)
  177.     txtVGrid = lGridHeight
  178.     txtHGrid = lGridWidth
  179. End Sub
  180. Private Sub txtHGrid_LostFocus()
  181.     If NumberGreaterThanZero(txtHGrid) Then pd_Page.HorizontalGrid = txtHGrid
  182. End Sub
  183. Private Sub txtVGrid_LostFocus()
  184.     If NumberGreaterThanZero(txtVGrid) Then pd_Page.VerticalGrid = txtVGrid
  185. End Sub
  186.