Printer.Print Questions

This Is a 2 part question. #1) I want to print a textbox.text to a certain paper location. I use printer.currentx and printer.currenty to specify, but I want my text to be centered there, not start there. How do I center align my text to this location?   #2)How do I specify Font Name? I call for a font named "BlackChance" using printer.font and/or printer.fontname and it still prints text in "Arial".  Any Help Would Be Apreciated....Points May ALso Be Increased for dificulties.
rhankins99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RuchiCommented:
try this one (I have not tried to test it)

Private Sub Command2_Click()
Dim MYTEXT As String

Printer.FontName = "BlackChance"
Printer.CurrentX = (Printer.Width / 2) - (TextWidth(MYTEXT) / 2)
Printer.CurrentY = (Printer.Height / 2) - (TextHeight(MYTEXT) / 2)
MYTEXT = "This is centered"
Printer.Print MYTEXT
Printer.EndDoc

0
RuchiCommented:
oops...

this is the correct one.

Private Sub Command2_Click()
Dim MYTEXT As String

Printer.FontName = "BlackChance"
MYTEXT = "This is centered"
Printer.CurrentX = (Printer.Width / 2) - (TextWidth(MYTEXT) / 2)
Printer.CurrentY = (Printer.Height / 2) - (TextHeight(MYTEXT) / 2)

Printer.Print MYTEXT
Printer.EndDoc
0
rhankins99Author Commented:
This does center the text to the page, but not to the location specified. (Ex. current x = 1" current y =3") I want to center a textbox1.text at current x and current y. and a textbox2.text at another current x and current y(ex. x = 3" and y = 3") The text is input by the user which is 2-10 characters. Text must be centered at x, y LOCATIONS, not center page.  
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

rhankins99Author Commented:
Adjusted points to 37
0
tirupur_selvaCommented:
Hi,
   Put the following code in a module. Position the printer with the CurrentY property and call the below function with the essential parameters.  

Public Function PadC(PadString$, Lenth%)
    Dim strRet$
    If Len(PadString) < Lenth Then
        strRet = Space((Lenth - Len(PadString)) / 2) + PadString
        PadC = strRet + Space(Lenth - Len(strRet))
    Else
        PadC = Left(PadString, Lenth)
    End If
End Function

I hope this would be useful.
Regs
Selva
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tirupur_selvaCommented:
for the second part of your question, increase more points.
0
rhankins99Author Commented:
Adjusted points to 50
0
moterkCommented:
Let (xpos, ypos) be the (x, y) point about which you want your text centered.  And mytext be a string var containing the text to be centered.

With Printer
..CurrentX =xpos-(.TextWidth(mytext)/2)
..CurrentY =ypos-(.TextHeight(mytext)/2)
..print mytext
End With

Should center the text where you want it.
0
moterkCommented:
For some reason an extra . showed up before the CurrentX, CurrentY, and Print
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.