Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. print page number

print page number

Scheduled Pinned Locked Moved C#
question
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hkl
    wrote on last edited by
    #1

    Hello, I posted a similar msg earlier and I am writing a print command in an application. All it does, is to print out a document with some headers and footers. So, I used a simple way to printout headers and footers. However, I still cannot keep track of the page numbers when I print out a document. I looked up the properties of printdocument, pagesetupdialog and printpreviewdialog, but I couldn't find any 'related' property. I also tried to keep track of page numbers in my print function (a loop to Graphics.DataString(...), but failed. Can anyone please give me some ideas? Thanks so much!!

    M 1 Reply Last reply
    0
    • H hkl

      Hello, I posted a similar msg earlier and I am writing a print command in an application. All it does, is to print out a document with some headers and footers. So, I used a simple way to printout headers and footers. However, I still cannot keep track of the page numbers when I print out a document. I looked up the properties of printdocument, pagesetupdialog and printpreviewdialog, but I couldn't find any 'related' property. I also tried to keep track of page numbers in my print function (a loop to Graphics.DataString(...), but failed. Can anyone please give me some ideas? Thanks so much!!

      M Offline
      M Offline
      mistery22
      wrote on last edited by
      #2

      I wrote an app where I could track the page number on a very easy way. Declare for the full app private int page = 1; At the end (last line) of your printDocument_PrintPage class add ++page in your PaintDocument class just use this.page The PaintDocument class is called from the printDocument_PrintPage class just to split up the drawing of the page in another class.

      H 1 Reply Last reply
      0
      • M mistery22

        I wrote an app where I could track the page number on a very easy way. Declare for the full app private int page = 1; At the end (last line) of your printDocument_PrintPage class add ++page in your PaintDocument class just use this.page The PaintDocument class is called from the printDocument_PrintPage class just to split up the drawing of the page in another class.

        H Offline
        H Offline
        hkl
        wrote on last edited by
        #3

        Thanks! That page number problem is solved. I am now trying to get the total number of pages.

        H 1 Reply Last reply
        0
        • H hkl

          Thanks! That page number problem is solved. I am now trying to get the total number of pages.

          H Offline
          H Offline
          hkl
          wrote on last edited by
          #4

          Oh, I solved the total page number problem too. Great!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups