datagridview打印

  private void toolStripButton79_Click(object sender, 

EventArgs e)
        {
            printDialog1.Document = printDocument1;
            DialogResult isok = printDialog1.ShowDialog();
            if (isok == DialogResult.OK)
            { printDocument1.Print(); }
        }

        private void printDocument1_PrintPage(object 

sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            System.Drawing.Font f = new 

System.Drawing.Font("宋体", 4.0f);
            e.Graphics.DrawString

(dataGridView5.DataSource.ToString

(),f,System.Drawing.Brushes.Black,34,34);
        }

 

posted @ 2016-01-27 14:38  つ无知的少年  阅读(143)  评论(0编辑  收藏  举报