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

  1. VERSION 5.00
  2. Object = "{52DE3A21-0A3F-11D4-B9D2-008048FD54E6}#2.0#0"; "POLARD~1.OCX"
  3. Begin VB.Form Form1 
  4.    Appearance      =   0  'Flat
  5.    BackColor       =   &H80000004&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "Polygon vertices Sample"
  8.    ClientHeight    =   9450
  9.    ClientLeft      =   150
  10.    ClientTop       =   720
  11.    ClientWidth     =   9315
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   9450
  15.    ScaleMode       =   0  'User
  16.    ScaleWidth      =   9315
  17.    StartUpPosition =   3  'Windows Default
  18.    Begin POLARDRAW20Lib.POLARDraw POLARDraw1 
  19.       Height          =   9255
  20.       Left            =   2640
  21.       TabIndex        =   22
  22.       Top             =   0
  23.       Width           =   6495
  24.       _Version        =   131072
  25.       _ExtentX        =   11456
  26.       _ExtentY        =   16325
  27.       _StockProps     =   224
  28.       PaperShadowColor=   1241780
  29.       DrawPaperOutline=   -1  'True
  30.       DrawPaperShadow =   -1  'True
  31.       PaperShadowOffset=   23780436
  32.       ViewportOriginX =   5813754
  33.       ViewportOriginY =   66487384
  34.       PageOriginX     =   2012272201
  35.       PageOriginY     =   440
  36.       HorizontalGrid  =   567
  37.       VerticalGrid    =   567
  38.       SelectionCount  =   2011661766
  39.       ShapeCount      =   1598273252
  40.       CanvasWidth     =   0
  41.       CanvasHeight    =   1598275446
  42.    End
  43.    Begin VB.CommandButton bttnConvertToPolygon 
  44.       Caption         =   "Convert To Polygon"
  45.       Height          =   375
  46.       Left            =   480
  47.       TabIndex        =   21
  48.       ToolTipText     =   "Converts selected shape to polygon."
  49.       Top             =   3480
  50.       Width           =   1815
  51.    End
  52.    Begin VB.ComboBox cmbShapeType 
  53.       Height          =   315
  54.       Left            =   480
  55.       Style           =   2  'Dropdown List
  56.       TabIndex        =   19
  57.       ToolTipText     =   "Specifies type of shape to be drawn."
  58.       Top             =   2160
  59.       Width           =   1815
  60.    End
  61.    Begin VB.CommandButton btnClearAll 
  62.       Caption         =   "Delete All"
  63.       Height          =   375
  64.       Left            =   480
  65.       TabIndex        =   17
  66.       ToolTipText     =   "Deletes all polygons."
  67.       Top             =   600
  68.       Width           =   1815
  69.    End
  70.    Begin VB.CommandButton btnDelete 
  71.       Caption         =   "Delete"
  72.       Height          =   375
  73.       Left            =   480
  74.       TabIndex        =   16
  75.       ToolTipText     =   "Deletes selected polygons."
  76.       Top             =   120
  77.       Width           =   1815
  78.    End
  79.    Begin VB.ComboBox cmbEditMode 
  80.       Height          =   315
  81.       Left            =   480
  82.       Style           =   2  'Dropdown List
  83.       TabIndex        =   2
  84.       ToolTipText     =   "Specifies one of Edit Modes."
  85.       Top             =   1440
  86.       Width           =   1815
  87.    End
  88.    Begin VB.ComboBox cmbPolygonType 
  89.       Height          =   315
  90.       Left            =   480
  91.       Style           =   2  'Dropdown List
  92.       TabIndex        =   1
  93.       ToolTipText     =   "Specifies  type of polygon that will be drawn (use if Curent Shape Type = Freeform)."
  94.       Top             =   2880
  95.       Width           =   1815
  96.    End
  97.    Begin VB.Frame Frame1 
  98.       Caption         =   "Polygon info:"
  99.       Height          =   5175
  100.       Left            =   240
  101.       TabIndex        =   4
  102.       ToolTipText     =   "Provides informations about selected polygon."
  103.       Top             =   4080
  104.       Width           =   2295
  105.       Begin VB.CommandButton btnReCalculate 
  106.          Caption         =   "Recalculate"
  107.          Height          =   375
  108.          Left            =   240
  109.          TabIndex        =   18
  110.          ToolTipText     =   "Re-calculate vertex positions (use after moving vertex by mouse)"
  111.          Top             =   4560
  112.          Width           =   1815
  113.       End
  114.       Begin VB.TextBox txtVertYPos 
  115.          Height          =   285
  116.          Left            =   240
  117.          TabIndex        =   15
  118.          ToolTipText     =   "Vertex y position, relative to the bounding box of polygon."
  119.          Top             =   4080
  120.          Width           =   1815
  121.       End
  122.       Begin VB.TextBox txtVertXPos 
  123.          Height          =   285
  124.          Left            =   240
  125.          TabIndex        =   13
  126.          ToolTipText     =   "Vertex x position, relative to the bounding box of polygon."
  127.          Top             =   3480
  128.          Width           =   1815
  129.       End
  130.       Begin VB.CommandButton btnMoveMinus 
  131.          Caption         =   "Move vertex -"
  132.          Height          =   375
  133.          Left            =   240
  134.          TabIndex        =   11
  135.          ToolTipText     =   "Moves vertex, specified by vertex index, up and left for 2000 units relative to bounding box of polygon."
  136.          Top             =   2160
  137.          Width           =   1815
  138.       End
  139.       Begin VB.CommandButton btnMovePlus 
  140.          Caption         =   "Move vertex +"
  141.          Height          =   375
  142.          Left            =   240
  143.          TabIndex        =   10
  144.          ToolTipText     =   "Moves vertex, specified by vertex index, down and right for 2000 units relative to bounding box of polygon."
  145.          Top             =   2640
  146.          Width           =   1815
  147.       End
  148.       Begin VB.TextBox txtVertexIndex 
  149.          Height          =   285
  150.          Left            =   240
  151.          TabIndex        =   9
  152.          ToolTipText     =   "You can select this number and type other number instead.  "
  153.          Top             =   1680
  154.          Width           =   1815
  155.       End
  156.       Begin VB.TextBox txtVertCount 
  157.          Height          =   285
  158.          Left            =   240
  159.          Locked          =   -1  'True
  160.          TabIndex        =   7
  161.          ToolTipText     =   "To get correct count of vertices, after adding new vertex by mouse in Edit Points Mode, click once again with mouse on polygon."
  162.          Top             =   1080
  163.          Width           =   1815
  164.       End
  165.       Begin VB.CommandButton btnPolygonInfo 
  166.          Caption         =   "Set Polygon Info"
  167.          Height          =   375
  168.          Left            =   240
  169.          TabIndex        =   6
  170.          ToolTipText     =   "Sets informations about selected polygon"
  171.          Top             =   360
  172.          Width           =   1815
  173.       End
  174.       Begin VB.Label Label6 
  175.          Caption         =   "Vertex y position:"
  176.          Height          =   255
  177.          Left            =   240
  178.          TabIndex        =   14
  179.          ToolTipText     =   "Vertex y position, relative to the bounding box of polygon."
  180.          Top             =   3840
  181.          Width           =   1215
  182.       End
  183.       Begin VB.Label Label5 
  184.          Caption         =   "Vertex x position:"
  185.          Height          =   255
  186.          Left            =   240
  187.          TabIndex        =   12
  188.          ToolTipText     =   "Vertex x position, relative to the bounding box of polygon."
  189.          Top             =   3240
  190.          Width           =   1215
  191.       End
  192.       Begin VB.Label Label4 
  193.          Caption         =   "Vertex index:"
  194.          Height          =   255
  195.          Left            =   240
  196.          TabIndex        =   8
  197.          ToolTipText     =   "Specifies a vertex of selected polygon."
  198.          Top             =   1440
  199.          Width           =   1575
  200.       End
  201.       Begin VB.Label Label3 
  202.          Caption         =   "Vertices count:"
  203.          Height          =   375
  204.          Left            =   240
  205.          TabIndex        =   5
  206.          ToolTipText     =   "Number of vertices in selected polygon."
  207.          Top             =   840
  208.          Width           =   1335
  209.       End
  210.    End
  211.    Begin VB.Label Label7 
  212.       Caption         =   "Current Shape Type:"
  213.       Height          =   255
  214.       Left            =   480
  215.       TabIndex        =   20
  216.       ToolTipText     =   "Specifies type of shape to be drawn."
  217.       Top             =   1920
  218.       Width           =   1575
  219.    End
  220.    Begin VB.Label Label2 
  221.       Caption         =   "Current Edit Mode:"
  222.       Height          =   255
  223.       Left            =   480
  224.       TabIndex        =   3
  225.       ToolTipText     =   "Specifies one of Edit Modes."
  226.       Top             =   1200
  227.       Width           =   1695
  228.    End
  229.    Begin VB.Label Label1 
  230.       Caption         =   "Current Polygon Type:"
  231.       Height          =   255
  232.       Left            =   480
  233.       TabIndex        =   0
  234.       ToolTipText     =   "Specifies  type of polygon that will be drawn (use if Curent Shape Type = Freeform)."
  235.       Top             =   2640
  236.       Width           =   1695
  237.    End
  238.    Begin VB.Menu show 
  239.       Caption         =   "&Show"
  240.       Index           =   1
  241.       Begin VB.Menu guidelines 
  242.          Caption         =   "&Guidelines"
  243.          Checked         =   -1  'True
  244.          Index           =   1
  245.          Shortcut        =   ^G
  246.       End
  247.       Begin VB.Menu connectors 
  248.          Caption         =   "&Connectors"
  249.          Index           =   1
  250.          Shortcut        =   ^N
  251.       End
  252.       Begin VB.Menu grid 
  253.          Caption         =   "&Grid"
  254.          Index           =   1
  255.          Shortcut        =   ^R
  256.       End
  257.    End
  258.    Begin VB.Menu about 
  259.       Caption         =   "&About"
  260.       Index           =   1
  261.       Begin VB.Menu sample 
  262.          Caption         =   "&This Sample"
  263.          Index           =   1
  264.       End
  265.       Begin VB.Menu draw 
  266.          Caption         =   "&POLAR Draw 2.0"
  267.          Index           =   1
  268.       End
  269.    End
  270. Attribute VB_Name = "Form1"
  271. Attribute VB_GlobalNameSpace = False
  272. Attribute VB_Creatable = False
  273. Attribute VB_PredeclaredId = True
  274. Attribute VB_Exposed = False
  275. Dim pd_environment As POLARDRAW20Lib.Environment
  276. Public arr_PolygonTypeConstants As Variant
  277. Public arr_PolygonTypeNames  As Variant
  278. Public arr_EditModeConstants As Variant
  279. Public arr_EditModeNames As Variant
  280. Public arr_ShapeTypeConstants As Variant
  281. Public arr_ShapeTypeNames As Variant
  282. Public IsCalculatedPolygonInfo As Boolean
  283. Public myShape As POLARDRAW20Lib.Shape
  284. 'Object myPoly is polygon we set info for.
  285. Public myPoly As POLARDRAW20Lib.Shape
  286. 'Object myVertices represents all vertices of myPoly.
  287. Public myVertices As POLARDRAW20Lib.Vertices
  288. 'Object myVertex represent one vertex of myPoly.
  289. Public myVertex As POLARDRAW20Lib.Vertex
  290. 'ItemIndex is index of myVertex in Vertices collection object.
  291. Public ItemIndex As Long
  292. Private Sub btnClearAll_Click()
  293.     'Deletes all polygons.
  294.     On Error Resume Next
  295.     For Each element In POLARDraw1.ActivePage.Shapes
  296.         If (myPoly Is Nothing) Then
  297.             POLARDraw1.ActivePage.Shapes.Delete
  298.         Else
  299.             If (element.ID = myPoly.ID) Then
  300.                 Set myPoly = Nothing
  301.                 txtVertCount = ""
  302.                 txtVertexIndex = ""
  303.                 txtVertXPos = ""
  304.                 txtVertYPos = ""
  305.                 POLARDraw1.ActivePage.Shapes.Delete
  306.             End If
  307.         End If
  308.     Next
  309. End Sub
  310. Private Sub btnDelete_Click()
  311. 'Deletes selected polygons.
  312. 'On Error Resume Next
  313.     If POLARDraw1.ActivePage.Selection.ShapeRange.Count = 0 Then
  314.         MsgBox "Nothing is selected."
  315.         Exit Sub
  316.     End If
  317.     If (myPoly Is Nothing) Then
  318.         POLARDraw1.ActivePage.Selection.ShapeRange.Delete
  319.     Else
  320.         For Each element In POLARDraw1.ActivePage.Selection.ShapeRange
  321.             If (element.ID = myPoly.ID) Then
  322.                 Set myPoly = Nothing
  323.                 txtVertCount = ""
  324.                 txtVertexIndex = ""
  325.                 txtVertXPos = ""
  326.                 txtVertYPos = ""
  327.                 POLARDraw1.ActivePage.Selection.ShapeRange.Delete
  328.                 Exit Sub
  329.             End If
  330.         Next
  331.         POLARDraw1.ActivePage.Selection.ShapeRange.Delete
  332.     End If
  333. End Sub
  334. Private Sub btnMoveMinus_Click()
  335. 'Moves specified vertex left and up for 2000 measurement units.
  336.     If (myPoly Is Nothing) Then Exit Sub
  337.     myVertex.Move -2000, -2000
  338.     txtVertXPos = myVertex.x
  339.     txtVertYPos = myVertex.y
  340. End Sub
  341. Private Sub btnMovePlus_Click()
  342. 'Moves specified vertex right and down for 2000 measurement units.
  343.     If (myPoly Is Nothing) Then Exit Sub
  344.     myVertex.Move 2000, 2000
  345.     txtVertXPos = myVertex.x
  346.     txtVertYPos = myVertex.y
  347. End Sub
  348. Private Sub btnPolygonInfo_Click()
  349. 'Calculates polygon info for first of selected shapes
  350. 'and colores that polygon in blue.
  351.     If (POLARDraw1.ActivePage.Selection.ShapeRange.Count = 0) Then
  352.         'If nothing is selected, there is a message:
  353.         MsgBox "Please select polygon."
  354.     Else
  355.      If (POLARDraw1.ActivePage.Selection.ShapeRange.Item(1).Type <> 0) Then
  356.      'If first of selected shapes is not polygon, then it's colored in red and
  357.      'appropriate message pops out.
  358.      
  359.         'Item(1) specifies shape in selection that is most backward by Z-order.
  360.         Set myShape = POLARDraw1.ActivePage.Selection.ShapeRange.Item(1)
  361.         myShape.Line.Color = vbRed
  362.         'Specified shape gets on front by Z-order (so next time he may not be Item(1)of the same selection!).
  363.         myShape.ZOrder (polBringToFront)
  364.         
  365.         MsgBox "Please convert red shape to polygon if you want to get it's vertices."
  366.      Else
  367.      'If at least one polygon is selected,
  368.      'first of selected polygons is colored in blue.
  369.      '(Polygon info will be calculated for that shape.)
  370.      'First all polygons on active page are colored in black:
  371.         POLARDraw1.ActivePage.Shapes.Range.Line.Color = vbBlack
  372.         
  373.         'Item(1) specifies shape in selection that is most backward by Z-order.
  374.         POLARDraw1.ActivePage.Selection.ShapeRange.Item(1).Line.Color = vbBlue
  375.         IsCalculatedPolygonInfo = True
  376.         
  377.         'Object myPoly is polygon we set info for.
  378.         Set myPoly = POLARDraw1.ActivePage.Selection.ShapeRange.Item(1)
  379.         
  380.         'Shape myPoly gets on front by Z-order (so next time he may not be Item(1)of the same selection!).
  381.         myPoly.ZOrder (polBringToFront)
  382.         
  383.         'Object myVertices represents all vertices of myPoly.
  384.         Set myVertices = myPoly.Vertices
  385.         
  386.         'By default is provided info for fist vertex of selected polygon:
  387.         ItemIndex = 1
  388.         'myVertex is Vertex object and represents one vertex of polygon
  389.         'which has been specified by it's index in Verticies collection.
  390.         Set myVertex = myVertices.Item(ItemIndex)
  391.         txtVertCount = myVertices.Count
  392.         txtVertexIndex = ItemIndex
  393.         
  394.         txtVertXPos = myVertex.x
  395.         txtVertYPos = myVertex.y
  396.         
  397.      End If
  398.     End If
  399. End Sub
  400. Private Sub btnReCalculate_Click()
  401. 'Recalculates vertex x and y positions.
  402. 'It's recommended to use after moving vertex by mouse.
  403.     If (myPoly Is Nothing) Then Exit Sub
  404.     txtVertXPos = myVertex.x
  405.     txtVertYPos = myVertex.y
  406. End Sub
  407. Private Sub bttnConvertToPolygon_Click()
  408.     If (POLARDraw1.ActivePage.Selection.ShapeRange.Count = 0) Then
  409.         MsgBox "Please select shape you want to convert to polygon."
  410.     Else
  411.         For Each element In POLARDraw1.ActivePage.Selection.ShapeRange
  412.             If (element.Line.Color = vbRed) Then
  413.                 element.Line.Color = vbBlack
  414.             End If
  415.             element.ConvertToPolygon
  416.             'If myPoly is Curved-type polygon, then he also will be changed with ConvertToPolygon function.
  417.             If (Not myPoly Is Nothing) Then
  418.                 If (POLARDraw1.ActivePage.Selection.ShapeRange.Item(1).ID = myPoly.ID) Then
  419.                     myPoly.ConvertToPolygon
  420.                     btnPolygonInfo_Click
  421.                   End If
  422.             End If
  423.          Next
  424.     End If
  425. End Sub
  426. Private Sub cmbEditMode_Click()
  427. 'Sets Edit Mode.
  428.     pd_environment.EditMode = cmbEditMode.ItemData(cmbEditMode.ListIndex)
  429. End Sub
  430. Private Sub cmbPolygonType_Click()
  431. 'Sets polygon type.
  432.     pd_environment.CurrentPolygonType = cmbPolygonType.ItemData(cmbPolygonType.ListIndex)
  433. End Sub
  434. Private Sub cmbShapeType_Click()
  435. 'Sets shape type.
  436.     pd_environment.CurrentShapeType = cmbShapeType.ItemData(cmbShapeType.ListIndex)
  437.     If (POLARDraw1.CurrentShapeType <> polFreeform) Then
  438.         cmbPolygonType.Enabled = False
  439.     Else
  440.         cmbPolygonType.Enabled = True
  441.     End If
  442. End Sub
  443. Private Sub connectors_Click(Index As Integer)
  444.     If connectors(1).Checked = False Then
  445.         connectors(1).Checked = True
  446.         POLARDraw1.ShowConnectors = True
  447.     Else
  448.         connectors(1).Checked = False
  449.         POLARDraw1.ShowConnectors = False
  450.     End If
  451. End Sub
  452. Private Sub draw_Click(Index As Integer)
  453.     POLARDraw1.AboutBox
  454. End Sub
  455. Private Sub Form_Load()
  456.     POLARDraw1.EditMode = polCreateNew
  457.     POLARDraw1.CurrentShapeType = polFreeform
  458.     POLARDraw1.CurrentPolygonType = polFreeformPoly
  459.     POLARDraw1.UndoSize = 0
  460.     POLARDraw1.ActiveWindow.FitTo polFitToWidth
  461.     'By default, guidelines are not visible.
  462.     POLARDraw1.ActivePage.HorGuidelines.Add 15
  463.     POLARDraw1.ActivePage.HorGuidelines.Add 302
  464.     POLARDraw1.ActivePage.VertGuidelines.Add 15
  465.     POLARDraw1.ActivePage.VertGuidelines.Add 185
  466.     guidelines(1).Checked = False
  467.     POLARDraw1.ShowGuidelines = False
  468.     'By default, connectors are not visible.
  469.     connectors(1).Checked = False
  470.     POLARDraw1.ShowConnectors = False
  471.     'By default, grid is not visible.
  472.     POLARDraw1.ShowGrid = False
  473.     IsCalculatedPolygonInfo = False
  474.     arr_PolygonTypeConstants = Array(polCurvePoly, polFreeformPoly, polScribblePoly)
  475.     arr_PolygonTypeNames = Array("Curved Polygon", "Free Form Polygon ", "Scribbled Polygon")
  476.     arr_EditModeConstants = Array(polCreateNew, polEditPoints, polResize, polRotate)
  477.     arr_EditModeNames = Array("Create New Shape", "Edit Points", "Resize", "Rotate")
  478.     arr_ShapeTypeConstants = Array(polArc, polDiamond, polDimensionBar, polEllipse, polFreeform, polHexagon, polIsoscelesTriangle, polLeftArrow, polLine, polLink, polOctagon, polParallelogram, polPentagon, polPlainText, polPlusSign, polRectangle, polRightTriangle, polRoundRectangle, polStar, polTextBox, polTrapezoid)
  479.     arr_ShapeTypeNames = Array("Arc", "Diamond", "Dimension Bar", "Ellipse", "Freeform", "Hexagon", "Isosceles Triangle", "Left Arrow", "Line", "Link", "Octagon", "Parallelogram", "Pentagon", "Plain Text", "Plus Sign", "Rectangle", "Right Triangle", "Round Rectangle", "Star", "Text Box", "Trapezoid")
  480.     For i = 0 To UBound(arr_PolygonTypeConstants)
  481.         cmbPolygonType.AddItem arr_PolygonTypeNames(i), i
  482.         cmbPolygonType.ItemData(i) = arr_PolygonTypeConstants(i)
  483.     Next i
  484.     For i = 0 To UBound(arr_EditModeConstants)
  485.        cmbEditMode.AddItem arr_EditModeNames(i), i
  486.        cmbEditMode.ItemData(i) = arr_EditModeConstants(i)
  487.     Next i
  488.     For i = 0 To UBound(arr_ShapeTypeConstants)
  489.         cmbShapeType.AddItem arr_ShapeTypeNames(i), i
  490.         cmbShapeType.ItemData(i) = arr_ShapeTypeConstants(i)
  491.     Next i
  492.     Set pd_environment = POLARDraw1.ActiveWindow.Environment
  493.     pd_environment.CurrentShapeType = polFreeform
  494.     pd_environment.CurrentPolygonType = polFreeformPoly
  495.     pd_environment.EditMode = polCreateNew
  496.     For i = 0 To UBound(arr_PolygonTypeConstants)
  497.         If cmbPolygonType.ItemData(i) = pd_environment.CurrentPolygonType Then cmbPolygonType.ListIndex = i
  498.     Next i
  499.     For i = 0 To UBound(arr_EditModeConstants)
  500.         If cmbEditMode.ItemData(i) = pd_environment.EditMode Then cmbEditMode.ListIndex = i
  501.     Next i
  502.     For i = 0 To UBound(arr_ShapeTypeConstants)
  503.         If cmbShapeType.ItemData(i) = pd_environment.CurrentShapeType Then cmbShapeType.ListIndex = i
  504.     Next i
  505. End Sub
  506. Private Sub Form_Unload(Cancel As Integer)
  507.     Set pd_environment = Nothing
  508.     Set myVertices = Nothing
  509.     Set myVertex = Nothing
  510.     Set myPoly = Nothing
  511.     Set myShape = Nothing
  512. End Sub
  513. Private Sub grid_Click(Index As Integer)
  514.     If grid(1).Checked = False Then
  515.         grid(1).Checked = True
  516.         POLARDraw1.ShowGrid = True
  517.     Else
  518.         grid(1).Checked = False
  519.         POLARDraw1.ShowGrid = False
  520.     End If
  521. End Sub
  522. Private Sub guidelines_Click(Index As Integer)
  523.     If guidelines(1).Checked = False Then
  524.         guidelines(1).Checked = True
  525.         POLARDraw1.ShowGuidelines = True
  526.     Else
  527.         guidelines(1).Checked = False
  528.         POLARDraw1.ShowGuidelines = False
  529.     End If
  530. End Sub
  531. Private Sub POLARDraw1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  532. 'When you add new vertex of polygon by mouse,
  533. 'count of vertices and vertex x and y positions need to be updated.
  534.     If (POLARDraw1.ActivePage.Selection.ShapeRange.Count > 0) And (IsCalculatedPolygonInfo = True) Then
  535.         If (myPoly Is Nothing) Then Exit Sub
  536.         
  537.         txtVertCount = myVertices.Count
  538.         txtVertXPos = myVertex.x
  539.         txtVertYPos = myVertex.y
  540.         
  541.     End If
  542. End Sub
  543. Private Sub sample_Click(Index As Integer)
  544.     AboutDlg.show vbModal, Me
  545. End Sub
  546. Private Sub txtVertexIndex_Change()
  547. 'You can change vertex index by hand.
  548.     If (myPoly Is Nothing) Then
  549.         txtVertexIndex = ""
  550.         Exit Sub
  551.     End If
  552.     Dim iCounter As Integer
  553.     Dim iLen As Integer
  554.     Dim iCountFromLeft As Integer
  555.     Dim iCounterFromLeft As Integer
  556.     Dim myString As String
  557.     Dim myChar As Variant
  558.     iLen = Len(txtVertexIndex)
  559.     iCountFromLeft = 1
  560.     'Assurance that vertex index is numeric value.
  561.     For iCounter = 1 To iLen
  562.         For iCounterFromLeft = 1 To iCountFromLeft
  563.             myString = Left(txtVertexIndex, iCountFromLeft)
  564.         Next iCounterFromLeft
  565.         myChar = Right(myString, 1)
  566.         If (IsNumeric(myChar) = False) Then
  567.             MsgBox "Index must be numeric value."
  568.             Exit Sub
  569.         End If
  570.         iCountFromLeft = iCountFromLeft + 1
  571.     Next iCounter
  572.     'Vertex index must be (>=1) and (<=count of vertices of that polygon).
  573.     If txtVertexIndex = "" Then
  574.         txtVertexIndex = 1
  575.     ElseIf txtVertexIndex = 0 Then
  576.         txtVertexIndex = 1
  577.         
  578.     Else
  579.         If (CInt(txtVertexIndex) > myVertices.Count) Then
  580.             MsgBox "Vertex index must be <= " + CStr(myVertices.Count)
  581.             txtVertexIndex = ItemIndex
  582.         Else
  583.             ItemIndex = txtVertexIndex
  584.             
  585.             Set myVertex = myVertices.Item(ItemIndex)
  586.             txtVertXPos = myVertex.x
  587.             txtVertYPos = myVertex.y
  588.             
  589.         End If
  590.     End If
  591. End Sub
  592. Private Sub txtVertXPos_Change()
  593. 'You can change vertex x position by hand.
  594.     If (myPoly Is Nothing) Then
  595.         txtVertXPos = ""
  596.         Exit Sub
  597.     End If
  598.     Dim iCounter As Integer
  599.     Dim iLen As Integer
  600.     Dim iCountFromLeft As Integer
  601.     Dim iCounterFromLeft As Integer
  602.     Dim myString As String
  603.     Dim myChar As Variant
  604.     iLen = Len(txtVertXPos)
  605.     iCountFromLeft = 1
  606.     'Assurance that vertex x position is numeric value.
  607.     For iCounter = 1 To iLen
  608.         For iCounterFromLeft = 1 To iCountFromLeft
  609.             myString = Left(txtVertXPos, iCountFromLeft)
  610.         Next iCounterFromLeft
  611.         myChar = Right(myString, 1)
  612.         If (IsNumeric(myChar) = False) Then
  613.             MsgBox "Index must be numeric value."
  614.             Exit Sub
  615.         End If
  616.         iCountFromLeft = iCountFromLeft + 1
  617.     Next iCounter
  618.     'Vertex x position must be (>0) and (<65536).
  619.     If (txtVertXPos = "") Then
  620.         txtVertXPos = 0
  621.         Set myVertex.x = txtVertXPos
  622.     Else
  623.         If (txtVertXPos > 65536) Then
  624.             MsgBox "Vertex x position must be <= 65536)."
  625.         Else
  626.             Set myVertex.x = txtVertXPos
  627.         End If
  628.     End If
  629. End Sub
  630. Private Sub txtVertYPos_Change()
  631. 'You can change vertex y position by hand.
  632.     If (myPoly Is Nothing) Then
  633.         txtVertYPos = ""
  634.         Exit Sub
  635.     End If
  636.     Dim iCounter As Integer
  637.     Dim iLen As Integer
  638.     Dim iCountFromLeft As Integer
  639.     Dim iCounterFromLeft As Integer
  640.     Dim myString As String
  641.     Dim myChar As Variant
  642.     iLen = Len(txtVertYPos)
  643.     iCountFromLeft = 1
  644.     'Assurance that vertex y position is numeric value.
  645.     For iCounter = 1 To iLen
  646.         For iCounterFromLeft = 1 To iCountFromLeft
  647.             myString = Left(txtVertYPos, iCountFromLeft)
  648.         Next iCounterFromLeft
  649.         myChar = Right(myString, 1)
  650.         If (IsNumeric(myChar) = False) Then
  651.             MsgBox "Index must be numeric value."
  652.             Exit Sub
  653.         End If
  654.         iCountFromLeft = iCountFromLeft + 1
  655.     Next iCounter
  656.     'Vertex y position must be (>0) and (<65536).
  657.     If (txtVertYPos = "") Then
  658.         txtVertYPos = 0
  659.         Set myVertex.y = txtVertYPos
  660.     Else
  661.         If (txtVertYPos > 65536) Then
  662.             MsgBox "Vertex y position must be <= 65536)."
  663.         Else
  664.             Set myVertex.y = txtVertYPos
  665.         End If
  666.     End If
  667. End Sub
  668.