Screen Caputre code not working
Posted: Mon Nov 19, 2012 9:50 pm
Hello well basically i want to take a screen print of a panel and its contents and apply this to a picturebox after searching the web i have built this out of code i learnt from the web but well my edit seems to have messed things up it takes a picutre of were the panel was on form load but does not take it when the form moves or of the hole panel only a small cornoer of it
So here is the code i am using
So here is the code i am using
Code: Select all
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim b As Bitmap
b = New Bitmap(Panel3.Width, Panel3.Height, Imaging.PixelFormat.Format32bppArgb)
Dim g As Graphics = Graphics.FromImage(b)
g.CopyFromScreen(Panel3.Location, Panel3.Location, New Size(Panel3.Width, Panel3.Height))
PictureBox3.SizeMode = PictureBoxSizeMode.StretchImage
PictureBox3.Image = b
End Sub