Bonjour tout le monde,
J'ai du mal à imprimer une datagridview via un contrôle PrintDocument. Comment faire ?
Merci pour votre aide.
Version imprimable
Bonjour tout le monde,
J'ai du mal à imprimer une datagridview via un contrôle PrintDocument. Comment faire ?
Merci pour votre aide.
Poste ton code.
@++ ;)
En fait voilà le code que j ai testé mais il ne m'imprime que le rectangle:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim myPaintArgs As New PaintEventArgs(e.Graphics, New Rectangle(New _ Point(0, 0), Me.Size)) Me.InvokePaint(dgRembourssement, myPaintArgs) End Sub Private Sub btnImprimer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImprimer.Click Dim dlg As New PrintDialog dlg.Document = PrintDocument1 Dim result As DialogResult = dlg.ShowDialog() If (result = System.Windows.Forms.DialogResult.OK) Then PrintDocument1.Print() End If End Sub
Télécharge la classe DGVprinter :
http://www.codeproject.com/KB/printing/DGVPrinter.aspx