|
-
Oct 6th, 2007, 03:42 PM
#1
Thread Starter
Frenzied Member
Center text in a box to print[RESOLVED]
Hi to all:
I would like print in a box a few lines of text but I want print this lines centering...
VB have some instruction to do this?
Thanks
Last edited by sacramento; Oct 7th, 2007 at 05:06 PM.
-
Oct 6th, 2007, 04:52 PM
#2
Addicted Member
Re: Center text in a box to print
I don't really know what this so called 'box' is.
But in label control there is the property Align, this aligns text (Eg in centre). Is this what you want?
 Originally Posted by Vanasha
Sorry, i'm slow.
-
Oct 6th, 2007, 04:54 PM
#3
Thread Starter
Frenzied Member
Re: Center text in a box to print
Hi:
No...that property it's to appear in the screen...I want print!
-
Oct 6th, 2007, 04:55 PM
#4
Addicted Member
Re: Center text in a box to print
Oh, printing to an object. Sorry I don't know.
 Originally Posted by Vanasha
Sorry, i'm slow.
-
Oct 6th, 2007, 06:33 PM
#5
Re: Center text in a box to print
to print to a form, in the center horizantal and vertical
vb Code:
printstr = "the string i want to print"
form1.currentx = (form1.scalewidth - form1.textwidth(printstr)) /2
form1.currenty = (form1.scaleheight - form1.textheight(printstr)) /2
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 6th, 2007, 08:35 PM
#6
Re: Center text in a box to print
he forgot to put form1.print printstr
-
Oct 7th, 2007, 04:53 AM
#7
Thread Starter
Frenzied Member
Re: Center text in a box to print
Hi:
Ok...this code print text center vertical and horizontal,but in the middle of a form...It's not exactly that I want to do!!!
That I want to do is:
1 - I Draw a box:
Code:
Printer.Line (700, 4600)-(5350, 7680), , B
Now I want put text "The String I want to Print" in this box but centered.
This is possible?
-
Oct 7th, 2007, 05:38 AM
#8
Re: Center text in a box to print
vb Code:
printer.currentx = (5350-700 - printer.textwidth(printstr)) /2
printer.currenty = (7680 - 4600 - printer.textheight(printstr)) /2
printer.print printstr
i think that should do it, but haven't tested
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 7th, 2007, 05:05 PM
#9
Thread Starter
Frenzied Member
Re: Center text in a box to print
ok,the code work!
Thanks a lot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|