28/10/2014, 18:43
Kod:
Private Sub D1Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles D1Button3.Click
Dim Yazi As New PrintDocument
Dim Dokuman As New PrintPreviewDialog
AddHandler Yazi.PrintPage, AddressOf Ciz
Dokuman.Document = Yazi
Dokuman.ShowDialog()
End Sub
Kod:
Private Sub Ciz(ByVal sender As Object, ByVal e As PrintPageEventArgs)
On Error Resume Next
Dim FontN6 As Font = New Font("Tahoma", 6, FontStyle.Regular)
Dim FontK6 As Font = New Font("Tahoma", 6, FontStyle.Bold)
Dim ortala As New StringFormat
Dim sağa_yasla As New StringFormat
Dim sola_yasla As New StringFormat
ortala.Alignment = StringAlignment.Center
sağa_yasla.Alignment = StringAlignment.Far
sola_yasla.Alignment = StringAlignment.Near
Dim inceçizgi As New Pen(Brushes.Black)
inceçizgi.Width = 0.5F
inceçizgi.DashStyle = DashStyle.Dot
Dim yukseklik As Integer = 0
Dim kolon As Integer = 0
Dim satir_genel As Integer = 1
Dim satir As Integer = 1
e.Graphics.DrawString("BEYANNAME KONTROL LİSTESİ", FontK6, Brushes.Black, New RectangleF(-25, 4, e.PageBounds.Width, e.PageBounds.Height), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(15, 20, 20, 15))
e.Graphics.DrawString("No", FontN6, Brushes.Black, New RectangleF(15, 22, 20, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(37, 20, 150, 15))
e.Graphics.DrawString("Firma Ünvanı", FontN6, Brushes.Black, New RectangleF(37, 22, 150, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(189, 20, 25, 15))
e.Graphics.DrawString("Evrak", FontN6, Brushes.Black, New RectangleF(189, 22, 25, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(216, 20, 50, 15))
e.Graphics.DrawString("Terk Tar.", FontN6, Brushes.Black, New RectangleF(216, 22, 50, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(275, 20, 20, 15))
e.Graphics.DrawString("No", FontN6, Brushes.Black, New RectangleF(275, 22, 20, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(297, 20, 150, 15))
e.Graphics.DrawString("Firma Ünvanı", FontN6, Brushes.Black, New RectangleF(297, 22, 150, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(449, 20, 25, 15))
e.Graphics.DrawString("Evrak", FontN6, Brushes.Black, New RectangleF(449, 22, 25, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(476, 20, 50, 15))
e.Graphics.DrawString("Terk Tar.", FontN6, Brushes.Black, New RectangleF(476, 22, 50, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(535, 20, 20, 15))
e.Graphics.DrawString("No", FontN6, Brushes.Black, New RectangleF(535, 22, 20, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(557, 20, 150, 15))
e.Graphics.DrawString("Firma Ünvanı", FontN6, Brushes.Black, New RectangleF(557, 22, 150, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(709, 20, 25, 15))
e.Graphics.DrawString("Evrak", FontN6, Brushes.Black, New RectangleF(709, 22, 25, 15), ortala)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(736, 20, 50, 15))
e.Graphics.DrawString("Terk Tar.", FontN6, Brushes.Black, New RectangleF(736, 22, 50, 15), ortala)
For Each row As DataGridViewRow In Mukellef_DataGridView.Rows
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(15 + (260 * kolon), 37 + yukseklik, 20, 15))
e.Graphics.DrawString(satir_genel, FontN6, Brushes.Black, New RectangleF(16 + (260 * kolon), 39 + yukseklik, 20, 15), sola_yasla)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(37 + (260 * kolon), 37 + yukseklik, 150, 15))
e.Graphics.DrawString(row.Cells(3).Value, FontN6, Brushes.Black, New RectangleF(38 + (260 * kolon), 39 + yukseklik, 150, 15), sola_yasla)
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(189 + (260 * kolon), 37 + yukseklik, 25, 15))
e.Graphics.DrawRectangle(inceçizgi, New Rectangle(216 + (260 * kolon), 37 + yukseklik, 50, 15))
e.Graphics.DrawString(Mid(row.Cells(14).Value, 4, 7), FontN6, Brushes.Black, New RectangleF(217 + (260 * kolon), 39 + yukseklik, 50, 15), sağa_yasla)
satir_genel += 1
If satir < 62 Then
yukseklik = satir * 17
Else
kolon += 1
satir = 0
yukseklik = satir * 17
End If
If kolon > 2 Then
kolon = 0
End If
satir += 1
Next
End Sub
Datagridden listelenen verilerim ile 3 bölüm ve 4 sütundan oluşan liste elde ediyorum
Sayfanı yüksekliği 62 satır.
62 satır x 3 bölüm = 186 adet firma yapıyor.
Sorum şudur: Datagridde firmalar 186 dan fazla ise 2. sayfa geçsin ve yukarıdaki kodların aynısını 2. sayfayada listelesin istiyorum.
Teşekkürler.