home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 November / pcwk_11_98a.iso / Wtestowe / SOFTSRC / vtrial15.exe / DATA.1 / DrawX.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-03-20  |  2.1 KB  |  64 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Vdraft Sample"
  4.    ClientHeight    =   1470
  5.    ClientLeft      =   5505
  6.    ClientTop       =   2010
  7.    ClientWidth     =   2895
  8.    Height          =   1875
  9.    Left            =   5445
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1470
  12.    ScaleWidth      =   2895
  13.    Top             =   1665
  14.    Width           =   3015
  15.    Begin VB.CommandButton Command1 
  16.       Caption         =   "Draw X"
  17.       Height          =   495
  18.       Left            =   720
  19.       TabIndex        =   0
  20.       Top             =   360
  21.       Width           =   1455
  22.    End
  23.    Begin VeventsLib.VdraftEvents VdraftEvents1 
  24.       Left            =   1080
  25.       Top             =   960
  26.       _Version        =   65536
  27.       _ExtentX        =   1085
  28.       _ExtentY        =   450
  29.       _StockProps     =   0
  30.    End
  31. Attribute VB_Name = "Form1"
  32. Attribute VB_Creatable = False
  33. Attribute VB_Exposed = False
  34. ' (C) Copyright 1997 by SoftSource.  All rights reserved.
  35. ' Sample Visual Basic code for working with Vdraft
  36. ' This code demonstrates how to use the VdraftEvents
  37. '   ActiveX Control to respond to events in Vdraft
  38. Private Sub Command1_Click()
  39.     Dim doc As Object
  40.     If VdraftEvents1.Connect = False Then
  41.         MsgBox "Could not Connect with Vdraft"
  42.         Exit Sub
  43.     End If
  44.     If VdraftEvents1.Vdraft.Documents.Count = 0 Then
  45.         Exit Sub
  46.     End If
  47.     Set doc = VdraftEvents1.Vdraft.ActiveDocument
  48.     ' have the user draw a line
  49.     doc.Entities.DrawLine
  50.     ' we want to know when the user finishes
  51.     VdraftEvents1.RequestDraw doc.PickEvents, 0
  52. End Sub
  53. Private Sub VdraftEvents1_DrawDone(ByVal info As Long)
  54.     Dim Entities, line1, line2 As Object
  55.     Set Entities = VdraftEvents1.Vdraft.ActiveDocument.Entities
  56.     ' get the line the user just drew
  57.     Set line1 = Entities.Last
  58.     ' create a new line
  59.     Set line2 = Entities.AddLine
  60.     ' set its endpoints so the lines form an X
  61.     line2.Where1.Set line1.Where1.X, line1.Where2.Y
  62.     line2.Where2.Set line1.Where2.X, line1.Where1.Y
  63. End Sub
  64.