home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "modText"
- '******************************************************************'
- '* *'
- '* TurboCAD for Windows *'
- '* Copyright (c) 1993 - 2001 *'
- '* International Microcomputer Software, Inc. *'
- '* (IMSI) *'
- '* All rights reserved. *'
- '* *'
- '******************************************************************'
-
- ' This sample draws texts
-
- Public Sub TextJustification()
- 'Sample draws texts with different Justification
-
- Dim App As Application
- Dim ActDr As Drawing
- Dim Grs As Graphics
- Dim GrText As Graphic
- Dim Pi#
- Pi = 3.14159
- Dim Justification%
- Dim ThisText$
- Set App = IMSIGX.Application
- Set ActDr = App.ActiveDrawing
- Set Grs = ActDr.Graphics
- For Justification = 1 To 5
- ThisText = "Justification = " & CStr(Justification)
- Set GrText = Grs.AddText(ThisText, 2, CDbl(Justification), 0, 0.5, 0, , , Justification)
- Next Justification
- End Sub
- Public Sub TextFont()
- 'Sample draw texts with different TextFont
- Dim App As Application
- Dim ActDr As Drawing
- Dim Grs As Graphics
- Dim GrText As Graphic
- Dim Pi#
- Pi = 3.14159
- Dim TextFont%
- Dim ThisText(8) As String
- ThisText(0) = "TimesNewRoman"
- ThisText(1) = "Italic"
- ThisText(2) = "GothicE"
- ThisText(3) = "CityBlueprint"
- ThisText(4) = "GreekS"
- ThisText(5) = "Impact"
- ThisText(6) = "Monotxt"
- Set App = IMSIGX.Application
- Set ActDr = App.ActiveDrawing
- Set Grs = ActDr.Graphics
- Dim x0#, y0#, angle#
- For TextFont = 0 To 6
- angle = 2 * Pi / 7 * TextFont
- x0 = 5 + 0.5 * Cos(angle)
- y0 = 5 + 0.5 * Sin(angle)
- Set GrText = Grs.AddText(ThisText(TextFont), x0, y0, 0, 0.5, angle)
- GrText.Properties("TextFont") = ThisText(TextFont)
- GrText.Properties("PenColor") = QBColor(2 * TextFont)
- Next TextFont
- End Sub
-
- Public Sub TextMode()
- 'Sample draw texts with different textMode
-
- Dim App As Application
- Dim ActDr As Drawing
- Dim Grs As Graphics
- Dim GrText As Graphic
- Dim Pi#
- Pi = 3.14159
- Dim txtMode(3) As String
- txtMode(1) = "Standard"
- txtMode(2) = "Scalable"
- txtMode(3) = "Flexible"
- Dim Mode%
- Dim ThisText$
- Set App = IMSIGX.Application
- Set ActDr = App.ActiveDrawing
- Set Grs = ActDr.Graphics
- For Mode = 1 To 3
- Set GrText = Grs.AddText(txtMode(Mode), 2, CDbl(Mode), 0, 0.5)
- GrText.Properties("TextMode") = Mode
- Next Mode
- End Sub
-
- Public Sub TextAlongCircle()
- Dim App As Application
- Dim ActDr As Drawing
- Dim Grs As Graphics
- Dim GrText As Graphic
- Dim GrCircle As Graphic
- Dim Pi#
- Pi = 3.14159
- Set App = IMSIGX.Application
- Set ActDr = App.ActiveDrawing
- Set Grs = ActDr.Graphics
-
- Set GrCircle = Grs.AddCircleCenterAndPoint(5, 5, 0, 5, 8, 0)
- Dim xc#, yc#, R#, xr#, yr#
- Dim ArcData(10) As Double
- GrCircle.GetArcData ArcData
- xc = ArcData(0)
- yc = ArcData(1)
- xr = ArcData(3)
- yr = ArcData(4)
- R = Sqr((xr - xc) * (xr - xc) + (yr - yc) * (yr - yc))
- Dim ThisText$
- ThisText = "QRwetweteteghghlkdfjhjdj"
- Dim txtLen As Long, i As Long
- Dim Symb$
- Dim dfi#, fi#, x#, y#
- Dim fiBeg#, fiEnd#
- fiBeg = 7 / 8 * Pi
- fiEnd = 1 / 4 * Pi
- Dim Htext#
- Htext = 0.25
- txtLen = Len(ThisText)
- dfi = (fiBeg - fiEnd) / (txtLen - 1)
- For i = 1 To txtLen
- Symb = Mid(ThisText, i, 1)
- fi = Pi - dfi * (i - 1)
- x = xc + R * Cos(fi)
- y = yc + R * Sin(fi)
- Set GrText = Grs.AddText(Symb, x, y, 0, Htext, fi - Pi / 2, , , 3)
- x = xc + (R + 1.1 * Htext) * Cos(fi)
- y = yc + (R + 1.1 * Htext) * Sin(fi)
- Set GrText = Grs.AddText(Symb, x, y, 0, Htext, fi - Pi / 2, , , 3)
- GrText.Properties("PenColor") = QBColor(13)
-
- Next i
-
- End Sub
-