U
ucasesoftware
I have just a problem to margin the Datagrid... Could someone help me ?
the datragid always print in the top LEFT
#Region " Impression "
'Déclaration
Private PrintPageSettings As New
System.Drawing.Printing.PageSettings
Private Sub mnItemImprimer_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnItemImprimer.Click
printDirect()
End Sub
Private Sub mnItemApercu_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles mnItemApercu.Click
printPreview()
End Sub
Private Sub mnItemMiseEnPage_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnItemMiseEnPage.Click
printPageSetup()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Try
Dim myArgs As New PaintEventArgs(e.Graphics, New
Rectangle(New Point(0, 0), Me.Size))
Select Case Me.ActiveMdiChild.Name
Case "boitesAuxLettres"
Me.InvokePaint(myForms.formBoitesAuxLettres.EasyDataGrid1, myArgs)
End Select
Catch ex As Exception
monErreur(ex)
End Try
End Sub
Private Sub printDirect()
PrintDocument1.Print()
End Sub
Private Sub printPreview()
Try
PrintDocument1.DefaultPageSettings = PrintPageSettings
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
Catch ex As Exception
monErreur(ex)
End Try
End Sub
Private Sub printPageSetup()
Try
PageSetupDialog1.PageSettings = PrintPageSettings
Dim Result1 As DialogResult = PageSetupDialog1.ShowDialog()
If Result1 = DialogResult.OK Then
'To Print
Try
PrintDocument1.DefaultPageSettings =
PrintPageSettings
PrintDialog1.Document = PrintDocument1
Dim Result As DialogResult =
PrintDialog1.ShowDialog
If Result = DialogResult.OK Then
PrintDocument1.Print()
End If
Catch ex As Exception
monErreur(ex)
End Try
End If
Catch ex As Exception
monErreur(ex)
End Try
End Sub
#End Region
the datragid always print in the top LEFT
#Region " Impression "
'Déclaration
Private PrintPageSettings As New
System.Drawing.Printing.PageSettings
Private Sub mnItemImprimer_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnItemImprimer.Click
printDirect()
End Sub
Private Sub mnItemApercu_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles mnItemApercu.Click
printPreview()
End Sub
Private Sub mnItemMiseEnPage_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnItemMiseEnPage.Click
printPageSetup()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Try
Dim myArgs As New PaintEventArgs(e.Graphics, New
Rectangle(New Point(0, 0), Me.Size))
Select Case Me.ActiveMdiChild.Name
Case "boitesAuxLettres"
Me.InvokePaint(myForms.formBoitesAuxLettres.EasyDataGrid1, myArgs)
End Select
Catch ex As Exception
monErreur(ex)
End Try
End Sub
Private Sub printDirect()
PrintDocument1.Print()
End Sub
Private Sub printPreview()
Try
PrintDocument1.DefaultPageSettings = PrintPageSettings
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
Catch ex As Exception
monErreur(ex)
End Try
End Sub
Private Sub printPageSetup()
Try
PageSetupDialog1.PageSettings = PrintPageSettings
Dim Result1 As DialogResult = PageSetupDialog1.ShowDialog()
If Result1 = DialogResult.OK Then
'To Print
Try
PrintDocument1.DefaultPageSettings =
PrintPageSettings
PrintDialog1.Document = PrintDocument1
Dim Result As DialogResult =
PrintDialog1.ShowDialog
If Result = DialogResult.OK Then
PrintDocument1.Print()
End If
Catch ex As Exception
monErreur(ex)
End Try
End If
Catch ex As Exception
monErreur(ex)
End Try
End Sub
#End Region