تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] يرجى المساعدة في تعديل كود الطباعة
#9
(10-04-17, 01:20 AM)abdualla كتب : تفضل التعديل
PHP كود :
   Private products As New Dictionary(Of StringString)

 
   Private Sub Form1_Load(sender As ObjectAs EventArgsHandles MyBase.Load
        DataGridView1
.ColumnCount 3
        DataGridView1
.Columns(0).Name "id"
 
       DataGridView1.Columns(1).Name " Name"
 
       DataGridView1.Columns(2).Name "Price"

 
       DataGridView1.Rows.Add("1""Product 1""1000")
 
       DataGridView1.Rows.Add("2""Product 1""2000")
 
       DataGridView1.Rows.Add("3""Product 1""3000")
 
       DataGridView1.Rows.Add("4""Product 4""4000")
 
       DataGridView1.Rows.Add("5""Product 5""5000")


 
       For Each r As DataGridViewRow In Me.DataGridView1.Rows
            If r
.IsNewRow Then Exit For
 
           Dim p As String r.Cells(1).Value
            If Not products
.Keys.Contains(pThen products.Add(p"")
 
       Next

        For i 
0 To products.Count 1
            For Each r 
As DataGridViewRow In Me.DataGridView1.Rows
                If r
.IsNewRow Then Exit For
 
               Dim k As String r.Cells(1).Value
                Dim v 
As String r.Cells(2).Value
                If products
.Keys(i) = k Then
                    products
(k) = products(k) & "Call: " vbNewLine
                End 
If
 
           Next
        Next

    End Sub

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

        Dim leftMargin 
As Integer e.MarginBounds.Left
        Dim topMargin 
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.Blue1)
 
       Dim cellSize As New Size(300100)

 
       Dim index As Integer 0

        For currentY 
0 To (products.Count 1) \ 2
            For currentX 
0 To 1

                Dim cellText 
As String =
 
                   "confirming QSO with " products.Keys(index) & vbNewLine _
                    products
(products.Keys(index))


 
               Dim cellPoint As New Point(leftMargin + (currentX cellSize.Width), topMargin + (currentY cellSize.Height))
 
               Dim cellRectangle As New Rectangle(cellPointcellSize)


 
               e.Graphics.FillRectangle(cellBackColorcellRectangle)

 
               e.Graphics.DrawString(cellText.TrimcellFontcellForeColorcellRectangle)

 
               e.Graphics.DrawRectangle(cellBorderColorcellRectangle)

 
               index += 1
                If index 
products.Count Then Exit For

 
           Next
        Next

    End Sub 


السلام عليك اخي عبدالله

بعد تجربة الكود عدة مرات اتضح ان هناك خلل بسيط

في حالت تواجد اكثر من سجل باسم واحد يطلع في مربع تحت بعض ويضيع الكلام

حاولت اجعل لكل مربع مثلا ادخالين واذا في اكثر يروح لمربع جديد


كمثال
Product 1
1000
2000
3000
2000
2000
3000
3000


الان نشوف ان Product 1 تحت 7  ادخالات
مثلا نجعل لكل مربع 3 ادخالات والباقي يفتح مربع جديد لكل 3 مربع
   


بس هذا التعديل وجزاك الله خير

لان من امس بليل احاول العب في الكود بس ما ضبط معاي 

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


الردود في هذا الموضوع
RE: يرجى المساعدة في تعديل كود الطباعة - بواسطة dubai.eig - 10-04-17, 08:55 AM


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


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