تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] سؤال عن استخدام e.HasMorePages = True
#2
تفضل التعديل على أن تضع Row=0 قبل كل طباعة
PHP كود :
Dim Row As Integer 0

Private Sub PrintDocument1_PrintPage(sender As ObjectAs Printing.PrintPageEventArgsHandles PrintDocument1.PrintPage

    Dim CellTopPos 
As Integer PrintDocument1.PrinterSettings.DefaultPageSettings.Margins.Top

    
For 0 To 19 ' عدد الأسطر 20 لكل صفحة

        Dim CellLeftPos As Integer = PrintDocument1.PrinterSettings.DefaultPageSettings.Margins.Left

        For Cell = 0 To DataGridView1.ColumnCount - 1

            Dim CellValue As String = DataGridView1.Rows(Row).Cells(Cell).Value.ToString()
            Dim CellWidth = DataGridView1.Rows(Row).Cells(Cell).Size.Width + 50
            Dim CellHeight = DataGridView1.Rows(Row).Cells(Cell).Size.Height

            Dim Brush As New SolidBrush(Color.Black)
            e.Graphics.DrawString(CellValue, New Font("Century Gothic", 10), Brush, CellLeftPos, CellTopPos)
            e.Graphics.DrawRectangle(Pens.Black, CellLeftPos, CellTopPos, CellWidth, CellHeight)

            CellLeftPos += CellWidth
        Next

        CellTopPos += DataGridView1.Rows(Row).Cells(0).Size.Height

        Row += 1
        If Row > DataGridView1.RowCount - 1 Then Exit For

    Next

    ' 
إذا لم تنتهي الأسطر أضف صفحة جديدة
    
If Row DataGridView1.RowCount Then e.HasMorePages True

End Sub 
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: سؤال عن استخدام e.HasMorePages = True - بواسطة عبـدالله - 18-04-17, 04:26 PM


التنقل السريع :


يقوم بقرائة الموضوع: