Dim x As Int32 = e.MarginBounds.Left Dim y As Int32 = e.MarginBounds.Top Dim fmt As New StringFormat(StringFormatFlags.LineLimit) fmt.LineAlignment = StringAlignment.Center fmt.Alignment = StringAlignment.Center Dim rec As Rectangle Dim mrow As Integer = 0 Dim h As Int32 = 0 Dim i As Int32 If newpage Then 'Dim image As Image 'e.Graphics.DrawImage(image, 20, 20, 70, 50) End If For i = mrow To tbl.Rows.Count - 1 x = e.MarginBounds.Left h = 0 x = e.MarginBounds.Left For j As Integer = 0 To tbl.Columns.Count - 1 rec = New Rectangle(x, y, 60, 30) e.Graphics.DrawRectangle(Pens.Black, rec) e.Graphics.DrawString(tbl.Rows(i)(j).ToString, rfont, Brushes.Black, rec, fmt) x += rec.Width h = Math.Max(h, rec.Height) Next y += h mrow += 1 If y + h > e.MarginBounds.Bottom Then e.HasMorePages = True 'mrow -= 1 newpage = True Return Else newpage = False End If Next
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)