[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
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.
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.
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.
Re: Printout formating problem
@:jmcilhinney
found it - it works like expected. many thx