Article | 41023353 |
Type | HowTo |
Product | Engine |
Version | 4.1.6.1028 |
Date Added | 12/29/2003 |
Submitted by | Takis |
Keywords |
How to use the StartSelectAtWindow
See the Visual Basic 6 sample code below:
Option Explicit Public GripsSelSet As vdSelection 'Selection Set Private Sub Form_Load() VDPro1.ActiveDocument.Open App.Path + "/vectordraw.dwg" End Sub Private Sub VDPro1_MouseDown(Button As Integer, Shift As Integer, x As Double, y As Double) Dim ent As vdFigure Dim i As Integer Dim pt As Variant i = 0 pt = VDPro1.CursorPos Select Case Button Case 1 If VDPro1.CommandAction.OpenLoops = 0 Then Set ent = VDPro1.ActiveDocument.GetEntityFromPOINT(pt) If GripsSelSet Is Nothing Then Set GripsSelSet = VDPro1.ActiveDocument.Selections.Add("GRIPSELSET") 'START WINDOW SELECT If ent Is Nothing Then If GripsSelSet.StartSelectAtWindow(pt) Then For Each ent In GripsSelSet SelectEntity ent, True i = i + 1 Next MsgBox "You have selected " + CStr(i) + " entities" End If Exit Sub End If 'END WINDOW SELECT (SHIFT DESELECTS) If Not ent Is Nothing Then If GripsSelSet.FindName(ent.Handle) Is Nothing And Shift <> vbShiftMask Then GripsSelSet.AddItem ent SelectEntity ent, True For Each ent In GripsSelSet SelectEntity ent, True i = i + 1 Next MsgBox "You have selected " + CStr(i) + " entities" ElseIf Shift = vbShiftMask Then GripsSelSet.RemoveItem ent SelectEntity ent, False For Each ent In GripsSelSet SelectEntity ent, True i = i + 1 Next MsgBox "You have selected " + CStr(i) + " entities" End If End If End If End Select End Sub Public Sub SelectEntity(ByRef ent As vdFigure, lSelect As Boolean) 'Select an Entity If lSelect Then ent.Invalidate ent.ShowGrips = 1 ent.HighLight = VdHightLightDot ent.DrawGrips Else 'UnSelect an Entity ent.Invalidate ent.ShowGrips = 0 ent.HighLight = VdHightLightShowNormal End If End Sub