print datagridview不包括所有行

时间:2014-08-16 12:32:56

标签: vb.net

我想要打印一个datagrid

搜索后,我使用以下内容实现了它:

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        PrintDocument1.Print()       
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

    Dim bm As New Bitmap(Me.DataGridView1.Width, Me.DataGridView1.Height)

    DataGridView1.DrawToBitmap(bm, New Rectangle(0, 0, Me.DataGridView1.Width, Me.DataGridView1.Height))
    e.Graphics.DrawImage(bm, 0, 0)
End Sub

它打印行但它只打印datagridview中显示的行

所以,如果我有100行,那么它们将被跳过。

是否有任何功能可以帮助我不仅绘制显示的值,还会绘制更低的值?

提前致谢!

0 个答案:

没有答案