Print Preview ActiveX Active Users: 80 / Visits Today: 454
Highest Active Users: 80
Print Preview ActiveX
Home | Profile | Register | Active Topics | Members | Search | FAQ | RSS
 All Forums
 Print Preview
 Tips & Tricks
 VB Routine: boxedTextAt

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert Email Insert CodeInsert QuoteInsert List

* Forum Code is ON
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert a File

Check here to subscribe to this topic.

T O P I C    R E V I E W
wbgookin Posted - 11/20/2004 : 02:29:03
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

Print Preview ActiveX © Mandix Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000 Version 3.4.02