Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

width of a char...

Status
Not open for further replies.

JeffSabat

Programmer
Sep 15, 2003
32
PH
How will I know the width of a character?
i'm creating a program that prints characters to a form using the Printer object and i want to position the text at the center of the form. The solution i am trying to create is by computing its width but how will i know the width of the character as every font type varies? pls help.
 
?Printer.TextWidth("I")
?Printer.TextWidth("W")
 
try

Code:
strMessage = 'Your message'
lngWidth = Printer.TextWidth(strMessage) / 2
Printer.CurrentX = Printer.ScaleWidth / 2 - lngWidth
Printer.CurrentY = 100
Printer.Print strMessage

this should centre the message on the printout



--------------------------------
Codito, ergo sum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top