home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Vdraft Sample"
- ClientHeight = 1470
- ClientLeft = 5505
- ClientTop = 2010
- ClientWidth = 2895
- Height = 1875
- Left = 5445
- LinkTopic = "Form1"
- ScaleHeight = 1470
- ScaleWidth = 2895
- Top = 1665
- Width = 3015
- Begin VB.CommandButton Command1
- Caption = "Draw X"
- Height = 495
- Left = 720
- TabIndex = 0
- Top = 360
- Width = 1455
- End
- Begin VeventsLib.VdraftEvents VdraftEvents1
- Left = 1080
- Top = 960
- _Version = 65536
- _ExtentX = 1085
- _ExtentY = 450
- _StockProps = 0
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- ' (C) Copyright 1997 by SoftSource. All rights reserved.
- ' Sample Visual Basic code for working with Vdraft
- ' This code demonstrates how to use the VdraftEvents
- ' ActiveX Control to respond to events in Vdraft
- Private Sub Command1_Click()
- Dim doc As Object
- If VdraftEvents1.Connect = False Then
- MsgBox "Could not Connect with Vdraft"
- Exit Sub
- End If
- If VdraftEvents1.Vdraft.Documents.Count = 0 Then
- Exit Sub
- End If
- Set doc = VdraftEvents1.Vdraft.ActiveDocument
- ' have the user draw a line
- doc.Entities.DrawLine
- ' we want to know when the user finishes
- VdraftEvents1.RequestDraw doc.PickEvents, 0
- End Sub
- Private Sub VdraftEvents1_DrawDone(ByVal info As Long)
- Dim Entities, line1, line2 As Object
- Set Entities = VdraftEvents1.Vdraft.ActiveDocument.Entities
- ' get the line the user just drew
- Set line1 = Entities.Last
- ' create a new line
- Set line2 = Entities.AddLine
- ' set its endpoints so the lines form an X
- line2.Where1.Set line1.Where1.X, line1.Where2.Y
- line2.Where2.Set line1.Where2.X, line1.Where1.Y
- End Sub
-