Imprimer plusieurs pages en vb.net avec la fonction HasMorePages
phanoudev
Messages postés33Date d'inscriptionmercredi 15 mars 2006StatutMembreDernière intervention 6 juillet 2006
-
17 mars 2006 à 13:14
phanoudev
Messages postés33Date d'inscriptionmercredi 15 mars 2006StatutMembreDernière intervention 6 juillet 2006
-
17 mars 2006 à 17:14
Bonjour,
je veux imprimer une msFlexGrid donc j'ai creer un bouton et un fonction qui imprime mais lorsque le debugger arrive sur la fonction HasMorePages, il ouvre une boite de dialogue indiquant impression mais rien ne se passe et le prog se bloque. Si je veux imprimer une seule page il n'ya pas de pb. voici le code des 2 fonctions, si quelqu'un a une idee merci d'avance pour l'aide
Private
Sub cmdPrint_Click(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles cmdPrint.Click
e.Graphics.DrawString("Valve Test Data for " & cboValveType.Text & " " & cboSpoolType.Text,
New Font("Arial", 14, FontStyle.Underline), Brushes.Black, leftMargin, yPos,
New StringFormat)
yPos = topMargin - 30
e.Graphics.DrawString("IDENTIFICATION", printFont, Brushes.Black, 0.5 * leftMargin, yPos,
New StringFormat)
e.Graphics.DrawString("DESCRIPTION", printFont, Brushes.Black, 2.5 * leftMargin, yPos,
New StringFormat)
e.Graphics.DrawString("VALUE", printFont, Brushes.Black, 6 * leftMargin, yPos,
New StringFormat)
yPos = topMargin
'read one line of the dataGrid, the 1st line of the page
line = msFlexGridConfig.get_TextMatrix(p + 1, 1)
'loop writing each line
While (count < lpp
And line <>
Nothing
And (count + p < msFlexGridConfig.Rows()))
yPos = yPos + printFont.GetHeight(e.Graphics)
'write the 1 column
e.Graphics.DrawString(line, printFont, Brushes.Black, 0.5 * leftMargin, yPos,
New StringFormat)
'write the 2 column
line = msFlexGridConfig.get_TextMatrix(count + p, 2)
e.Graphics.DrawString(line, printFont, Brushes.Black, 2.5 * leftMargin, yPos,
New StringFormat)
'write the 3 column
line = msFlexGridConfig.get_TextMatrix(count + p, 3)
e.Graphics.DrawString(line, printFont, Brushes.Black, 6 * leftMargin, yPos,
New StringFormat)
count = count + 1
If (count + p < msFlexGridConfig.Rows())
Then
'((count < lpp) And (count < msFlexGridConfig.Rows())) Then
line = msFlexGridConfig.get_TextMatrix(count + p, 1)
Else
line =
Nothing
End
If
End
While
'if there are still lines in the dataGrid
If (line <>
Nothing)
Then
p = count
count = 0
yPos = topMargin
e.HasMorePages =
True 'partie a pb
Else
e.HasMorePages =
False
Exit
Sub
End
If
ErrorHandler:
MsgBox("Error printing data to printer.", MsgBoxStyle.ApplicationModal + MsgBoxStyle.Critical, MMain.APP_NAME)
Exit
Sub
End
Sub
A voir également:
Imprimer plusieurs pages en vb.net avec la fonction HasMorePages
phanoudev
Messages postés33Date d'inscriptionmercredi 15 mars 2006StatutMembreDernière intervention 6 juillet 20061 17 mars 2006 à 17:14
en fait le probleme ne vient pas de hasmorepages mais du erreur handler, je ne sais pas l'expliquer, si je le met en commentaire le prog fonctionne et si je le remet il envoi un message d'erreur mais imprime quand meme????
Si quelqu'un sait m'expliquer ce qu'il se pqsse, je le remercie