Impression en vb.net

1217meyrin Messages postés 159 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 6 février 2007 - 19 oct. 2005 à 16:43
scaryman Messages postés 492 Date d'inscription vendredi 30 janvier 2004 Statut Membre Dernière intervention 16 mai 2007 - 19 oct. 2005 à 21:32
Bonjour,
est-il possible d'imprimer un form avec une échelle plus grande ou plus petite qu'à l'écran?
comment imprimer en paysage?

voici mon code pour imprimer en vb.net


Private
Sub CaptureScreen()



Dim mygraphics
As Graphics =
Me.CreateGraphics()



Dim s
As Size =
Me.Size


memoryImage =
New Bitmap(s.Width, s.Height, mygraphics)



Dim memoryGraphics
As Graphics = Graphics.FromImage(memoryImage)



Dim dc1
As IntPtr = mygraphics.GetHdc



Dim dc2
As IntPtr = memoryGraphics.GetHdc


BitBlt(dc2, 0, 0,
Me.ClientRectangle.Width, _



Me.ClientRectangle.Height, dc1, 0, 0, 13369376)


mygraphics.ReleaseHdc(dc1)


memoryGraphics.ReleaseHdc(dc2)



End
Sub


Private Sub MenuItem3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click



Me.WindowState = FormWindowState.Maximized


CaptureScreen()



Dim PrintDialog1
As
New PrintDialog()


PrintDialog1.Document = PrintDocument1



Dim result
As DialogResult = PrintDialog1.ShowDialog()



If (result = DialogResult.OK)
Then



'Me.Size = New System.Drawing.Size(640, 480)


PrintDocument1.Print()



End
If



Me.WindowState = FormWindowState.Normal



End
Sub



Private
Sub PrintDocument1_PrintPage(
ByVal sender
As System.Object,
ByVal e
As System.Drawing.Printing.PrintPageEventArgs)
Handles PrintDocument1.PrintPage



Dim x = (e.PageBounds.Width -
Me.Width) \ 2



Dim y = (e.PageBounds.Height -
Me.Height) \ 2


e.Graphics.DrawImage(memoryImage, x, y)



End
Sub


merci pour votre réponse.

Pascal

1 réponse

scaryman Messages postés 492 Date d'inscription vendredi 30 janvier 2004 Statut Membre Dernière intervention 16 mai 2007 12
19 oct. 2005 à 21:32
salut
ici c'est du java pas du vb
0
Rejoignez-nous