simple printing question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jack Russell

    #1

    simple printing question

    Gee vb.net makes me feel dumb!

    My understanding is that I set up and do all of my printing in the
    printdocument printpage and handler using various graphics methods such
    as drawstring.

    Is that correct?

    If so how do I force a form feed?

    Thanks

    Jack Russell
  • Ron Allen

    #2
    Re: simple printing question

    Jack,
    A formfeed/page eject occurs when you return from the OnPrintPage event
    of the document. So, you need to keep track of your print position outside
    that (I normally use class variables for my PrintDocument subclass) and draw
    each page image in OnPrintPage. Set HasMorePages on the PrintPageEventA rgs
    variable to true when another page needs to be done before returning and set
    it to false when the print job is complete.
    Yes, DrawString and the other drawing methods are for drawing on the
    page. Normally using PrintDocument requires a slightly different logic path
    for printing than previous MS methods for VB6, C++ although it is closer to
    C++.
    Note that to get precise width/height of strings for alignment or
    centering you need to use one of the MeasureString overrides that includes a
    StringFormat and supply an instance of StringFormat.Ge nericTypographi c.
    There are a lot of articles on this and other drawing/printing things in
    microsoft.publi c.dotnet.framew ork.drawing.

    Ron Allen
    "Jack Russell" <jackr@norubbis h.tpg.com.au> wrote in message
    news:uxUdOUeVFH A.1200@TK2MSFTN GP14.phx.gbl...[color=blue]
    > Gee vb.net makes me feel dumb!
    >
    > My understanding is that I set up and do all of my printing in the
    > printdocument printpage and handler using various graphics methods such
    > as drawstring.
    >
    > Is that correct?
    >
    > If so how do I force a form feed?
    >
    > Thanks
    >
    > Jack Russell[/color]


    Comment

    • Jack Russell

      #3
      Re: simple printing question

      Ron,

      Thanks

      Jack

      Ron Allen wrote:[color=blue]
      > Jack,
      > A formfeed/page eject occurs when you return from the OnPrintPage event
      > of the document. So, you need to keep track of your print position outside
      > that (I normally use class variables for my PrintDocument subclass) and draw
      > each page image in OnPrintPage. Set HasMorePages on the PrintPageEventA rgs
      > variable to true when another page needs to be done before returning and set
      > it to false when the print job is complete.
      > Yes, DrawString and the other drawing methods are for drawing on the
      > page. Normally using PrintDocument requires a slightly different logic path
      > for printing than previous MS methods for VB6, C++ although it is closer to
      > C++.
      > Note that to get precise width/height of strings for alignment or
      > centering you need to use one of the MeasureString overrides that includes a
      > StringFormat and supply an instance of StringFormat.Ge nericTypographi c.
      > There are a lot of articles on this and other drawing/printing things in
      > microsoft.publi c.dotnet.framew ork.drawing.
      >
      > Ron Allen
      > "Jack Russell" <jackr@norubbis h.tpg.com.au> wrote in message
      > news:uxUdOUeVFH A.1200@TK2MSFTN GP14.phx.gbl...
      >[color=green]
      >>Gee vb.net makes me feel dumb!
      >>
      >>My understanding is that I set up and do all of my printing in the
      >>printdocume nt printpage and handler using various graphics methods such
      >>as drawstring.
      >>
      >>Is that correct?
      >>
      >>If so how do I force a form feed?
      >>
      >>Thanks
      >>
      >>Jack Russell[/color]
      >
      >
      >[/color]

      Comment

      Working...