تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] طباعة محتوي نصي بدون كريستال ريبورت
#4
(31-10-17, 09:39 PM)a.ahmed كتب :
PHP كود :
Public Class Form1

    Dim TextLines
() As String

    Dim TotalPages 
As Integer 0
    Dim PageNo 
As Integer 0

    Dim LinesPerPage 
As Integer 5


    Private Sub Button1_Click
(ByVal sender As ObjectByVal e As EventArgsHandles Button1.Click

        TextLines 
Label1.Text.Trim.Split(vbCrLf)

 
       TotalPages Math.Ceiling(TextLines.Count LinesPerPage)
 
       PageNo 1

        PrintPreviewDialog1
.ShowDialog()

 
   End Sub


    Private Sub PrintDocument1_PrintPage
(ByVal sender As ObjectByVal e As Printing.PrintPageEventArgsHandles PrintDocument1.PrintPage

        Dim VerticalPos 
As Single 1000
        Dim fnt 
As New Font("Arial"10)
 
       Dim lineHeight As Single fnt.Height()

 
       Dim bmp As Bitmap PictureBox1.Image()
 
       e.Graphics.DrawImage(bmp, New Rectangle(New Point(200VerticalPos), New Size(500100)))

 
       For i 0 To LinesPerPage 1

            Dim lineIndex 
As Integer = ((PageNo 1) * LinesPerPage) + i
            If lineIndex 
TextLines.Count Then Exit For

 
           Dim y As Single VerticalPos + (lineHeight)

 
           Dim txt As String TextLines(lineIndex).Trim()
 
           e.Graphics.DrawString(txtfntBrushes.Black, New Point(100y))

 
       Next

        If PageNo 
TotalPages Then
            PageNo 
+= 1
            e
.HasMorePages True
        End 
If

 
   End Sub

End 
Class 

تبقي جزء من المشكلة عند الدخول لصفحة جديدة يطبع يكمل الاين الخاص باليبل بقاعدة الصفحة الثانية والثالثة وليس براس ومقدمة الصفحة
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: طباعة محتوي نصي بدون كريستال ريبورت - بواسطة محمد اسماعيل - 31-10-17, 09:54 PM


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


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