How To DataGridView Printing in
How To DataGridView Printing in
net
Este sitio utiliza cookies de Google para prestar sus servicios y para analizar su tráfico. Tu
dirección IP y user-agent se comparten con Google, junto con las métricas de rendimiento y de
seguridad, para garantizar la calidad del servicio, generar estadísticas de uso y detectar y
solucionar abusos.
MÁS INFORMACIÓN ACEPTAR
Tags
C#
C++
Datab
Html
Java
JAVA
MySq
PHP
Pytho
SQL
Tutor
Vb.Ne
Visua
Visua
Here in the PrintPage event we create a Bitmap Object and draw the Blog A
DataGridView to the Bitmap Object. In order to run this vb.net project you Mar 2
have to drag two buttons ,one for load data and one for print command, and
Feb 2
drag a PrintDocument control on your form .
Jan 2
Dec 2
Home Features Video Tutorials Downloads Contact us
Nov 2
https://www.sourcecodeph.com/2022/02/how-to-datagridview-printing-in-vbnet.html 1/7
18/4/22, 14:32 How to DataGridView Printing in VB.net
In order to run this vb.net project you have to drag two buttons ,one for load
data and one for print command, and drag a PrintDocument control on your
form . The following picture shows how to drag PrintDocument Object to your
project.
Dim rc As Rectangle
Este
sitio
Dim utiliza
x Ascookies
Int32 =de
50Google
' Dim para
x Asprestar
Int32 sus servicios y para analizar su tráfico. Tu
dirección IP y user-agent se comparten con Google, junto con las métricas de rendimiento y de
Dim h As Int32 = 0
seguridad, para garantizar la calidad del servicio, generar estadísticas de uso y detectar y
Dimabusos.
solucionar row As DataGridViewRow
e.Graphics.DrawString("SUMMARY ATTENDANCE", New Font("Century
MÁS INFORMACIÓN ACEPTAR
Gothic", 12, FontStyle.Bold), Brushes.Black, New Point(310, YAxis + 15))
' e.Graphics.DrawString("Client Name: " & FULLNAME.Text, New
Font("Century Gothic", 10, FontStyle.Bold), Brushes.Black, New Point(100,
YAxis + 50))
'e.Graphics.DrawString("Date Print: " & Date.Now.ToLongDateString,
New Font("Century Gothic", 10, FontStyle.Bold), Brushes.Black, New
Point(100, YAxis + 75))
'e.Graphics.DrawString("Total Amount: " & LabelTotalPayment.Text,
New Font("Century Gothic", 10, FontStyle.Bold), Brushes.Black, New
Point(100, YAxis + 100))
e.Graphics.FillRectangle(Brushes.LightGray, rc)
e.Graphics.DrawRectangle(Pens.Black, rc)
https://www.sourcecodeph.com/2022/02/how-to-datagridview-printing-in-vbnet.html 3/7
18/4/22, 14:32 How to DataGridView Printing in VB.net
End Select
Este sitio utiliza cookies de Google para prestar sus servicios y para analizar su tráfico. Tu
dirección IP y user-agent se comparten con Google, junto con las métricas de rendimiento y de
seguridad, para garantizar la calidad del servicio, generar estadísticas de uso y detectar y
e.Graphics.DrawString(DataGridView1.Columns(cell.ColumnIndex).HeaderTe
solucionar abusos.
xt,
MÁS INFORMACIÓN ACEPTAR
DataGridView1.Font, Brushes.Black, rc,
fmt)
x += rc.Width
h = Math.Max(h, rc.Height)
End If
Next
y += h
End If
newpage = False
row = DataGridView1.Rows(thisNDX)
x = 50 'x = e.MarginBounds.Left
h=0
Home Features Video Tutorials Downloads Contact us
e.Graphics.DrawRectangle(Pens.Black, rc)
https://www.sourcecodeph.com/2022/02/how-to-datagridview-printing-in-vbnet.html 4/7
18/4/22, 14:32 How to DataGridView Printing in VB.net
Este
sitio
utiliza cookies
Select de Google para prestar sus servicios y para analizar su tráfico. Tu
Case
dirección IP y user-agent se comparten con Google, junto con las métricas de rendimiento y de
DataGridView1.Columns(cell.ColumnIndex).DefaultCellStyle.Alignment
seguridad, para garantizar la calidad del servicio, generar estadísticas de uso y detectar y
abusos.
solucionar Case DataGridViewContentAlignment.BottomRight,
DataGridViewContentAlignment.MiddleRight
MÁS INFORMACIÓN ACEPTAR
fmt.Alignment = StringAlignment.Far
rc.Offset(-1, 0)
Case DataGridViewContentAlignment.BottomCenter,
DataGridViewContentAlignment.MiddleCenter
fmt.Alignment = StringAlignment.Center
Case Else
fmt.Alignment = StringAlignment.Near
rc.Offset(2, 0)
End Select
e.Graphics.DrawString(cell.FormattedValue.ToString(),
DataGridView1.Font, Brushes.Black, rc, fmt)
x += rc.Width
h = Math.Max(h, rc.Height)
End If
Next
y += h
' next row to print
mRow = thisNDX + 1
Next
End Sub
Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles
btnPrint.Click
Call print()
Home Features Video Tutorials Downloads Contact us
End Sub
https://www.sourcecodeph.com/2022/02/how-to-datagridview-printing-in-vbnet.html 5/7
18/4/22, 14:32 How to DataGridView Printing in VB.net
Responsive Advertisement
Posted by:
Source Code Ph
Related Posts
0
Comments
Home Features Video Tutorials Downloads Contact us
https://www.sourcecodeph.com/2022/02/how-to-datagridview-printing-in-vbnet.html 6/7
18/4/22, 14:32 How to DataGridView Printing in VB.net
Este sitio utiliza cookies de Google para prestar sus servicios y para analizar su tráfico. Tu
dirección IP y user-agent
Enter se comparten con Google, junto con las métricas de rendimiento y de
your comment...
seguridad, para garantizar la calidad del servicio, generar estadísticas de uso y detectar y
solucionar abusos.
MÁS INFORMACIÓN ACEPTAR
Tags Categori
Email: [email protected]
https://www.sourcecodeph.com/2022/02/how-to-datagridview-printing-in-vbnet.html 7/7