'How can I display the whole DataGridView control to print it in vb.net?

This code gives me a part of DataGridView control

Public grid as DataGridView
...
Dim image As New Bitmap(grid.Width - 1, grid.Height - 1)
grid.DrawToBitmap(image, New Rectangle(0, 0, grid.Width - 1, grid.Height - 1))
Me.Graphics.DrawImage(image, 0, 0)

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source