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
  1. Home
  2. General Programming
  3. C#
  4. Printing GDI Drawing objects

Printing GDI Drawing objects

Scheduled Pinned Locked Moved C#
graphicsquestion
2 Posts 2 Posters 0 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.
  • F Offline
    F Offline
    free_soul424
    wrote on last edited by
    #1

    I am using “System.Drawing.Printing” to print a drawing. Drawing consists a lot of rectangles, and lines. Actually my drawing is very large in size. Can any one tell me how can I devide drawing into pages. I will be thankful to you. Regards,

    L 1 Reply Last reply
    0
    • F free_soul424

      I am using “System.Drawing.Printing” to print a drawing. Drawing consists a lot of rectangles, and lines. Actually my drawing is very large in size. Can any one tell me how can I devide drawing into pages. I will be thankful to you. Regards,

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      get size of your drawing. create a bitmap using, then get graphics from the bitmap. Now use that graphics object to draw your objects. After finishing drawing objects, copy image to PrintPage event's argument's graphics object. Bitmap bmp=new Bitmap(width,height); //Now create graphics from this bmp Graphics g=Graphics.FromImage(bmp); //draw you objects to this graphics object //g.DrawRectangle(..) //finish drawing Graphics gr=e.Graphics; //e is PrintPageEventArgs object //int x,y; declare these two variables at class level so that every time you raise PrintPage event they are available with previous values //x=y=0; initialize before calling //Loop to draw all image page by page RectangleF rf=new RectangleF(0,0,printPageWidth, printPageHeight); gr.DrawImage(bmp,rf); //now add width and height of rectangle to start // to get next page x +=printPageWidth e.HasMorePages=true; //this will cause the print event handler to be called again Sorry i'm not very legible. But hope you will get an idea. Aman Tur

      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