09-04-17, 08:15 PM
تفضل التعديل
PHP كود :
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim leftMagin As Integer = e.MarginBounds.Left
Dim topMagin As Integer = e.MarginBounds.Top
Dim cellFont As New Font("Arial", 14)
Dim cellForeColor As New SolidBrush(Color.Black)
Dim cellBackColor As New SolidBrush(Color.WhiteSmoke)
Dim cellBorderColor As New Pen(Brushes.Blue, 1)
Dim cellSize As New Size(300, 100)
Dim index As Integer = 0
For currentY = 0 To (Me.DataGridView1.Rows.Count - 1) \ 2
For currentX = 0 To 1
Dim cellText As String =
"confirming QSO with" & Me.DataGridView1.Rows(index).Cells(1).Value & vbNewLine & _
"Call: " & Me.DataGridView1.Rows(index).Cells(2).Value
Dim cellPoint As New Point(leftMagin + (currentX * cellSize.Width), topMagin + (currentY * cellSize.Height))
Dim cellRectangle As New Rectangle(cellPoint, cellSize)
e.Graphics.FillRectangle(cellBackColor, cellRectangle)
e.Graphics.DrawString(cellText, cellFont, cellForeColor, cellRectangle)
e.Graphics.DrawRectangle(cellBorderColor, cellRectangle)
index += 1
If index > Me.DataGridView1.Rows.Count - If(Me.DataGridView1.AllowUserToAddRows, 2, 1) Then Exit For
Next
Next
End Sub

