تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] مشكلة الصفحات الجديدة عند الطباعة
#1
السلام عليكم

عندي داتاجريد فيو بها سلع واريد صنع باركود لها علي اساس يتم اختيار الصنف من خلال شيك بوكس بكل صف واختيار السعر وعمل باركود بالسعر مثلا وبعد ذالك يتم اختيار صف او مجموعة صفوف او كل الصفوف عند فحصة واختيار ة من عمود شيك بوكس لطباعة معا .

دية اعمدة الداتا جريد

كود :
.Columns.Add("CheckPrint", GetType(Boolean))
          .Columns.Add("BarCode", GetType(Image))
          .Columns.Add("Price", GetType(Integer))
          .Columns.Add("Num", GetType(Integer))
          .Columns.Add("qualty", GetType(String))
          .Columns.Add("Name", GetType(String))

دة كود نقل الباركود لعمود الصور بالداتا جريد فيو

كود :
Dim barcodes As New List(Of Image)
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    On Error Resume Next
    barcodes.Clear()
    For Each r As DataGridViewRow In GetCheckedRows(DataGridView1, 0)
        With r
            Dim im As Image = Code128Rendering.MakeBarcodeImage(.Cells("Price").Value.ToString, .Cells("Num").Value.ToString, .Cells("qualty").Value.ToString, .Cells("Name").Value.ToString, 2, True)
            .Cells("BarCode").Value = im

            barcodes.Add(im)

        End With
    Next
End Sub

دة كود فحص عمود شيك بوكس لمعرفة الصنف بالصفوف المراد طباعتة

كود :
Function GetCheckedRows(ByVal dgv As DataGridView, ByVal col As Integer) As List(Of DataGridViewRow)
    Dim checkedRows As New List(Of DataGridViewRow)
    For inx As Integer = 0 To dgv.RowCount - 1
        dgv(1, inx).Value = Nothing
        Dim checked As DataGridViewCheckBoxCell = TryCast(dgv(col, inx), DataGridViewCheckBoxCell)
        If CBool(checked.EditedFormattedValue) Then checkedRows.Add(dgv.Rows(inx))
    Next
    Return checkedRows
End Function


دةكود الطباعة 

كود :
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
      On Error Resume Next
      Dim x As Integer = 20
      Dim y As Integer = 300
      For Each bc As Image In barcodes
          e.Graphics.DrawImage(bc, New Point(x, y))
          y += 200
      Next
  End Sub

ودة كود العرض قبل الطباعة


كود :
Private Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click
       On Error Resume Next
       PrintPreviewDialog1.Show()
   
End Sub


عندي مشكة في الاتي :

1- الكود بيطبع وبيظهر الباركود بالداتاجريد اولا وبعد ذالك بصفحةالطبااعة ولكن المشكلة الاولي ان الباركود يصل لاخر الصفحة ولاينتقل لصفحة طباعة الجديدة
2- اريد الطباعة ان تتم ووضع الاسم اعلي الباركود والسعر ااسفل منة لكل باركود بصفحة الطباعة

صورةلطباعة وتحديد شكل المشكلة

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


الردود في هذا الموضوع
مشكلة الصفحات الجديدة عند الطباعة - بواسطة محمد اسماعيل - 02-08-19, 04:23 AM


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


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