Results 1 to 5 of 5

Thread: [Resolved] Printout formating problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    Köln
    Posts
    395

    [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.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    Köln
    Posts
    395

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    Köln
    Posts
    395

    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
  •  



Click Here to Expand Forum to Full Width