StretchBltQue fait donc cette api dans ton code ?
e.HasMorePages = Falseà true pour pouvoir avoir plusieurs pages mais ca ne resoud pas mon probleme car jusqu'à maintenant, je fais une sorte de capture qui s'enregistre en .jpg in fine. Or comment faire pour n'avoir qu'un fichier jpg de plusieurs pages ????? en PDF c'est concevable mais pas en jpg non ?
ce que je ne peux pas faire en jpg
'bitmap 100x100 Dim b As New Bitmap(300, 300) 'outil graphique Dim g As Graphics = Graphics.FromImage(b) 'fond bleu g.CopyFromScreen(New Point(Me.Left, Me.Top), New Point(0, 0), New Size(300, 300), CopyPixelOperation.SourceCopy) 'carré rouge au centre g.DrawRectangle(New Pen(Brushes.Red, 3), 100, 100, 100, 100) 'écriture quelconque g.DrawString("blabla", New Font("Courier New", 30), Brushes.Blue, 25, 25) 'sauvegarde jpeg b.Save("taille_reelle.jpg", Imaging.ImageFormat.Jpeg) 'bitmap 50x50 Dim bmini As New Bitmap(100, 100) 'outil graphique g = Graphics.FromImage(bmini) 'réduction en jpeg g.DrawImage(b, New Rectangle(0, 0, 100, 100), New Rectangle(0, 0, 300, 300), GraphicsUnit.Pixel) 'sauvegarde bmini.Save("taille_mini.jpg", Imaging.ImageFormat.Jpeg)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionIl y a vraiment quelque chose qui m'echappe serieusement la
g.DrawImage(b, New Rectangle(0, 0, 100, 100), New Rectangle(0, 0, 300, 300), GraphicsUnit.Pixel)
Private Sub print_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles print.Click If printerlist() = String.Empty Then messageaff = "No printer available on this station" infoaff = "Error" MessageBox.Show(messageaff, infoaff, MessageBoxButtons.OK, MessageBoxIcon.Error) Else Try Dim p As New ClassImpression(Me) showimage = p.GetPreview p.printdoc() Catch ex As Exception messageaff = "Printer Error : end of the impression" infoaff = "Error" MessageBox.Show(messageaff, infoaff, MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End If End Sub
'ajout d'un panel au formulaire Dim pnl As New Panel With {.Parent Me, .Bounds New Rectangle(20, 20, 200, 200), .AutoScroll = True} 'nouveau bitmap de taille de l'écran Dim b As New Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height) 'outil de dessin Dim g As Graphics = Graphics.FromImage(b) 'copie de l'écran sur le bitmap g.CopyFromScreen(New Point(0, 0), New Point(0, 0), Screen.PrimaryScreen.WorkingArea.Size, CopyPixelOperation.SourceCopy) 'ajout d'un picturebox sur le panel Dim p As New PictureBox With {.SizeMode PictureBoxSizeMode.AutoSize, .Parent pnl} 'affichage de l'image p.Image = CType(b.Clone, Image)
Private Function Capturectrl(ByVal ctrl As Control) As Bitmap Dim memoryImage As Bitmap Dim mygraphics As Graphics = ctrl.CreateGraphics() Dim s As Size = ctrl.Size memoryImage = New Bitmap(s.Width - 3, s.Height - (SystemInformation.FrameBorderSize.Width + 3 + SystemInformation.CaptionHeight), mygraphics) Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage) Dim dc1 As IntPtr = mygraphics.GetHdc Dim dc2 As IntPtr = memoryGraphics.GetHdc StretchBlt(dc2, 0, 0, ctrl.ClientRectangle.Width, _ ctrl.ClientRectangle.Height, dc1, 0, 0, 13369376) mygraphics.ReleaseHdc(dc1) memoryGraphics.ReleaseHdc(dc2) Return memoryImage End Functionde mon classimpression
C'est comme si quelque chose ne collait pasJe constate que tu utilises encore l'api.
Je me demandais,, crystal report ne pourrait pas faciliter la tache ?Ouvre un autre sujet de discussion pour poser cette question.