26-04-23, 08:48 PM
PHP كود :
Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click
' Create a new PrintDocument object
Dim pd As New PrintDocument()
' Set the PrintPage event handler for the document
AddHandler pd.PrintPage, AddressOf PrintListView
' Print the document
pd.Print()
End Sub
Private Sub PrintListView(ByVal sender As Object, ByVal e As PrintPageEventArgs)
' Set the font and margins for the document
Dim font As New Font("Arial", 12)
Dim margin As Integer = e.MarginBounds.Top
Dim xPos As Integer = e.MarginBounds.Left
' Loop through the items in the ListView control
For Each item As ListViewItem In ListView1.Items
' Print each item on a new line
e.Graphics.DrawString(item.Text, font, Brushes.Black, xPos, margin)
margin += font.Height
Next
End Sub

