Print Preview ActiveX Active Users: 51 / Visits Today: 266
Highest Active Users: 110
Print Preview ActiveX
Home | Profile | Register | Active Topics | Members | Search | FAQ | RSS
Save Password
Forgot your Password?

 All Forums
 Print Preview
 Tips & Tricks
 VB Routine: boxedTextAt
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic: VB Routine: paraTextHeight Topic Next Topic: Inno Setup Example  

Junior Member

113 Posts

Posted - 11/20/2004 :  02:29:03  Show Profile  Visit wbgookin's Homepage  Reply with Quote
Here's a routine I use to draw a text string with a box around it. It works for me, but your mileage may vary.

Function boxedTextAt(prn As PrintPreview5.Preview, ByVal textToPrint As Variant, ByVal xPos As Variant, ByVal yPos As Variant, ByVal boxOffset As Variant) As Long
'xPos, yPos are the upper left coordinates of the BOX, not of the text
'boxOffset is the distance between the box and the text
'The function returns the Y position of the lower part of the BOX, in twips

'First draw the box
prn.DrawLine prn.C_Twips(xPos), prn.C_Twips(yPos), prn.C_Twips(xPos) + 2 * prn.C_Twips(boxOffset) + prn.TextWidth(textToPrint & ""), prn.C_Twips(yPos) + 2 * prn.C_Twips(boxOffset) + prn.TextHeight(textToPrint & ""), prLBBox

'Now draw the text
prn.AddTextAt textToPrint, prn.C_Twips(xPos) + prn.C_Twips(boxOffset), prn.C_Twips(yPos) + prn.C_Twips(boxOffset)

'Set the return value, and set the currentY position
boxedTextAt = prn.C_Twips(yPos) + 2 * prn.C_Twips(boxOffset) + prn.TextHeight(textToPrint & "")
prn.CurrentY = boxedTextAt

End Function
Go to Bottom of Page
  Previous Topic: VB Routine: paraTextHeight Topic Next Topic: Inno Setup Example  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Print Preview ActiveX © Mandix Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000 Version 3.4.02