تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] يرجى المساعدة في تعديل كود الطباعة
#7
تفضل التعديل
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 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 
الرد }}}
تم الشكر بواسطة: dubai.eig , dubai.eig


الردود في هذا الموضوع
RE: يرجى المساعدة في تعديل كود الطباعة - بواسطة abdualla - 10-04-17, 01:20 AM


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


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