Article | 41023677 |
Type | HowTo |
Product | Engine |
Version | 5.0.0.1033 |
Date Added | 8/23/2004 |
Submitted by | watersoft001@sina.com |
Keywords |
Dim IsOnMoveGrip As Boolean Private Sub Command1_Click() VDStd1.CommandAction.CmdPolyLine "USER" VDStd1.ActiveDocument.Entities.Last.ShowGrips = True VDStd1.Redraw End Sub Private Sub Form_Load() VDStd1.GripSize = 10 VDStd1.ActiveDocument.Selections.Add "Grip_SET" End Sub Private Sub VDStd1_DrawAfterEntity(ByVal Render As VDStdLib.vdRender, ByVal VdEntityObject As VDStdLib.vdFigure) If VdEntityObject.Type = "VDPOLYLINE" Then Dim i Dim myPolyline As vdPolyline Dim aVertex Set myPolyline = VdEntityObject For i = 0 To myPolyline.GetNumVerticies() - 1 aVertex = myPolyline.GetVertexAt(i) Render.Drawtext CStr(i), aVertex(0), aVertex(1), aVertex(2), VDStd1.ActiveDocument.TextStyles.FindName("STANDARD") ', 10 Next i End If End Sub Private Sub VDStd1_MouseDown(Button As Integer, Shift As Integer, x As Double, y As Double) If VDStd1.CommandAction.OpenLoops > 0 Then Exit Sub Dim Ent As vdFigure Dim GripSelSet As vdSelection Dim Index As Integer Dim indexes() As Long Dim selVert(0 To 1) As Double Dim success As Boolean Dim Grips As Variant Dim newPt As Variant If Button = 1 Then Set GripSelSet = VDStd1.ActiveDocument.Selections.FindName("Grip_SET") If GripSelSet Is Nothing Then Exit Sub If IsOnMoveGrip = False Then success = VDStd1.ActiveDocument.GetGripFromPOINT(VDStd1.CursorPos, Ent, Index) If success Then Grips = Ent.Grips selVert(0) = Grips(Index, 0) selVert(1) = Grips(Index, 1) IsOnMoveGrip = True newPt = VDStd1.Utility.GetLine(selVert) IsOnMoveGrip = False If IsEmpty(newPt) Then Exit Sub ReDim indexes(0) indexes(0) = Index Ent.MoveGripPointsAt indexes, newPt(0) - selVert(0), newPt(1) - selVert(1) VDStd1.Redraw Else Set Ent = VDStd1.ActiveDocument.GetEntityFromPOINT(VDStd1.CursorPos) If Ent Is Nothing Then Exit Sub Ent.ShowGrips = 1 Ent.DrawGrips GripSelSet.AddItem Ent End If End If ElseIf Button = 2 Then If Not IsOnMoveGrip Then PopupMenu mnuView End If End Sub