Article | 41024007 |
Type | HowTo |
Product | Engine |
Version | 5.1.1.1037 |
Date Added | 6/7/2005 |
Submitted by | Christian HolBrook |
Keywords |
Private Sub Command1_Click()
'line types which create shapes must have their own TextStyle which must not be used in objects other than linetype elements.
' Do not use STANDARD for shape style linetypes!!
Dim myltype As vdLineType
Dim myline As vdLine
Dim style1 As vdTextstyle
vdraw.ActiveDocument.New
Set style1 = vdraw.ActiveDocument.TextStyles.Add("LineType_A")
style1.FontFile = "Arial"
Set myltype = vdraw.ActiveDocument.LineTypes.Add("test_A")
myltype.Comments = "vdtestA ____ 1001 ____ 1001 ____"
myltype.NumDashes = 3
myltype.SetDashAt 0, 1
myltype.SetDashAt 1, -0.7
myltype.SetDashAt 2, -0.7
myltype.SetShapeOffsetAt 1, -0.7, 0#
myltype.SetShapeStyleAt 1, "LineType_A"
myltype.SetFlagAt 1, 2 'Use 2 for True type fonts and then SetTextAt to define the text
myltype.SetTextAt 1, "1001"
myltype.SetShapeScaleAt 1, 0.4
'Active textstyle must be always other than textstyle which is using for linetypes
'Do not use STANDARD for shape style linetypes!!
vdraw.ActiveDocument.ActiveTextStyle = "STANDARD"
Dim line1 As vdLine
Dim line2 As vdLine
Set line1 = vdraw.ActiveDocument.ActiveLayOut.Entities.AddLine(Array(0, 0, 0), Array(10, 0, 0))
line1.PenStyle = 100 + myltype.Index
Set line2 = vdraw.ActiveDocument.ActiveLayOut.Entities.AddLine(Array(0, 5, 0), Array(10, 5, 0))
line2.PenStyle = 100 + myltype.Index
vdraw.CommandAction.Zoom "E", 0, 0
Command2.Enabled = True
Command3.Enabled = True
End Sub
Private Sub Command2_Click()
'edits linetype "test_A"
Dim myltype As vdLineType
Set myltype = vdraw.ActiveDocument.LineTypes.FindName("test_A")
If Not myltype Is Nothing Then
myltype.SetTextAt 1, "1002"
myltype.Comments = "vdtestA ____ 1002 ____ 1002 ____"
End If
vdraw.Redraw
Command2.Enabled = False
Command3.Enabled = False
End Sub
Private Sub Command3_Click()
Dim line As vdLine
Dim myltype As vdLineType
Dim style1 As vdTextstyle
'Creates a new linetype "test_B"
Set style1 = vdraw.ActiveDocument.TextStyles.Add("LineType_B")
style1.FontFile = "Arial"
Set myltype = vdraw.ActiveDocument.LineTypes.Add("test_B")
myltype.Comments = "vdtestB ____ 1002 ____ 1002 ____"
myltype.NumDashes = 3
myltype.SetDashAt 0, 1
myltype.SetDashAt 1, -0.7
myltype.SetDashAt 2, -0.7
myltype.SetShapeOffsetAt 1, -0.7, 0#
myltype.SetShapeStyleAt 1, "LineType_B"
myltype.SetFlagAt 1, 2 'Use 2 for True type fonts and then SetTextAt to define the text
myltype.SetTextAt 1, "1002"
myltype.SetShapeScaleAt 1, 0.4
'Active textstyle must be always other than textstyle which is using for linetypes
'Do not use STANDARD for shape style linetypes!!
vdraw.ActiveDocument.ActiveTextStyle = "STANDARD"
Set line = vdraw.ActiveDocument.Entities.Last
line.PenStyle = 100 + myltype.Index
vdraw.Redraw
Command2.Enabled = False
Command3.Enabled = False
End Sub