En faite j'essaie de faire que à chaque fois que l'on appuis sur le bouton, le screen apparait dans une picturebox
à coté de la précédente picturebox sans que les picturebox sorte du panel
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionalors tu dois rétrécir ta capture, c'est plus compliqué
Private listpic As New List(Of PictureBox) Private Sub Addpic() Dim pic As New PictureBox With pic .Width = 50 .Height = 50 .Location = New Point(Panel2.Width + 3, 3) End With listpic.Add(pic) Me.Controls.Add(pic) End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim bounds As Rectangle Dim screenshot As System.Drawing.Bitmap Dim graph As Graphics bounds = Screen.PrimaryScreen.Bounds screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb) graph = Graphics.FromImage(screenshot) graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy) picturebox1.Image = screenshot Dim Save_screen As New SaveFileDialog Try Save_screen.Title = "save file" Save_screen.FileName = "C:\users\samir\desktop\screenshoot" & My.Settings.CompteurSave & ".bmp" Save_screen.Filter = "bitmap | *.bmp" PictureBox1.Image.Save(Save_screen.FileName, System.Drawing.Imaging.ImageFormat.Bmp) My.Settings.CompteurSave = My.Settings.CompteurSave + 1 Catch ex As Exception End Try End Sub
Private Function BitmapProduit() As Bitmap Dim bounds As Rectangle Dim screenshot As System.Drawing.Bitmap Dim graph As Graphics bounds = Screen.PrimaryScreen.Bounds screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb) graph = Graphics.FromImage(screenshot) graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy) Return screenshot End Function
Private Sub AjouterPictureBox(ByVal Bmp As Bitmap) Dim pic As New PictureBox, Rang As Integer listpic.Add(pic) : Rang = listpic.IndexOf(pic) ' : MessageBox.Show(Rang.ToString) With pic .Width = 50 .Height = 50 .Left = 3 + 56 * Rang .Top = 3 .Image = Bmp End With Panel2.Controls.Add(pic) End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click AjouterPictureBox(BitmapProduit) End Sub
Panel2.HorizontalScroll.Enabled = False
Ce qui se conçoit bien s'énonce clairement,
Et les mots pour le dire viennent aisément.
.Left = 3 + 56 * Rang .Top = 3
l'ami mirsa57 n'aime pas Boileau