|
-
Jun 1st, 2005, 11:55 PM
#1
Thread Starter
Hyperactive Member
[Resolved] Printout formating problem
Greetings, how can I make sure that when i printing numbers to paper there
are proper right aligned on a predefined position. e.g. I have a few numbers
which have to be like on a invoice to be printed.
All numbers are decimal numbers and have 2 digits after the decimal.
My idea would be like:
print string to position - (lenght of the string)
where position = fixed value
Many thanks in advance
Manfred
Last edited by Bongo; Jun 2nd, 2005 at 01:03 AM.
-
Jun 2nd, 2005, 12:01 AM
#2
Re: Printout formating problem
You can use the Graphics class to measure strings. Then when you print your string you would base the X positon on the alignment border less the width of the string.
-
Jun 2nd, 2005, 12:08 AM
#3
Thread Starter
Hyperactive Member
Re: Printout formating problem
@: jmcilhinney
thx. would you know which member of the class this is?
in the moment I use the following methode to print something.
e.Graphics.DrawString(strAnrede,new Font("Arial",10),new SolidBrush(Color.Black),72,200);
where 72 and 200 the x and teh y position is.
-
Jun 2nd, 2005, 12:27 AM
#4
Re: Printout formating problem
Lookup the Graphics.MeasureString method, which has several overloads. I would guess that you would use Graphics.MeasureString(String, Font) to measure your string using the intended print font.
-
Jun 2nd, 2005, 01:02 AM
#5
Thread Starter
Hyperactive Member
Re: Printout formating problem
@:jmcilhinney
found it - it works like expected. many thx
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
|