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. Print Datagridview

Print Datagridview

Scheduled Pinned Locked Moved C#
graphics
3 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.
  • Y Offline
    Y Offline
    yueru
    wrote on last edited by
    #1

    I've already done every article it's seem to be useful but can't fulfill my request. I've just wanted to print all of my data from my datagrid. I have code it can run but this   result is far from my thinking here is code

    private void button3_Click(object sender, EventArgs e)
    {
    printDocument1.Print();
    }
    public void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
    PaintEventArgs myPaintArgs = new PaintEventArgs(e.Graphics, new Rectangle(new Point(0, 0), this.Size));
    this.InvokePaint(dataGridView1, myPaintArgs);

    when i click on button3 it can print but show just only i can see from   datagrid not all of datagrid Thank in advance !!!!

    L 1 Reply Last reply
    0
    • Y yueru

      I've already done every article it's seem to be useful but can't fulfill my request. I've just wanted to print all of my data from my datagrid. I have code it can run but this   result is far from my thinking here is code

      private void button3_Click(object sender, EventArgs e)
      {
      printDocument1.Print();
      }
      public void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
      {
      PaintEventArgs myPaintArgs = new PaintEventArgs(e.Graphics, new Rectangle(new Point(0, 0), this.Size));
      this.InvokePaint(dataGridView1, myPaintArgs);

      when i click on button3 it can print but show just only i can see from   datagrid not all of datagrid Thank in advance !!!!

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, printing is a rather complex issue. The overall picture is your app has to do the pagination, it has to decide how much data fits on a page (PrintPage event will fire once for every page), and you should set PrintEventArgs.HasMorePages true for all but the last page. Furthermore, you have to keep track of the printing progress and implement the PrintPage handler such that it delivers the data belonging on the page currently being printed. I don't have a simple example available, but there are lots of them on google. Maybe this one[^] can help you. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      Y 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, printing is a rather complex issue. The overall picture is your app has to do the pagination, it has to decide how much data fits on a page (PrintPage event will fire once for every page), and you should set PrintEventArgs.HasMorePages true for all but the last page. Furthermore, you have to keep track of the printing progress and implement the PrintPage handler such that it delivers the data belonging on the page currently being printed. I don't have a simple example available, but there are lots of them on google. Maybe this one[^] can help you. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


        Y Offline
        Y Offline
        yueru
        wrote on last edited by
        #3

        Thank you very much   for helping ^^ It's useful and I'm having a problem with datagridview right but I gonna deal with it. :) Although it's so hurt ,I still choose love.

        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