Private Sub CenterTextAt(ByVal txt As String, ByVal x As _
Single, ByVal y As Single)
Dim hgt As Single
Dim wid As Single
' Mark the center for debugging.
Me.Line (x - 120, y)-Step(240, 0), vbRed
Me.Line (x, y - 120)-Step(0, 240), vbRed
hgt = Me.TextHeight(txt)
wid = Me.TextWidth(txt)
Me.CurrentX = x - wid / 2
Me.CurrentY = y - hgt / 2
Me.Print txt;
End Sub
|