when i run the following code
if i set the res to 300 or 2400 i get the same results
the type ends up right justified but off by a tiny amount but visually
noticeable on printed piece
am i doing something wrong or is this a short coming of RB
Note some of the additional int and double assignments was just my
attempt to get more precision
watch for email line breaks
Sub PrintRightJustified(theText as String, g as Graphics, ColStart as
double , ColWidth as double,
theHeight as double, theFont As String, theFontSize As integer, Bold
as boolean)
dim res, theWidth, xDoub, thePageLeft as double
dim x, y, intWidth as integer
dim buff as picture
thePageLeft = ps.pageLeft
res = 300
buff = NewPicture(colWidth*res,1*res,1)
buff.horizontalResolution = res
buff.verticalResolution = res
buff.graphics.TextFont = theFont
buff.graphics.textSize = (theFontSize * res) / 72
buff.graphics.Bold = Bold
theWidth = buff.graphics.stringWidth(theText)
xDoub = ((ColStart * res) + thePageLeft) + (ColWidth * res) - theWidth
intWidth = Ceil(theWidth)
x = Floor(xDoub)
y = (theHeight * res) + ps.pageTop
g.textFont = theFont
g.textSize = (theFontsize * res) / 72
g.bold = Bold
msgBox str(intWidth+x)
g.drawString theText, x, y
|