[HELP] Chross-Thread PictureBox PointToScreen

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
11 posts Page 2 of 2
Contributors
User avatar
SumCode
Dedicated Member
Dedicated Member
Posts: 57
Joined: Fri Aug 03, 2012 2:34 am

albertuschw wrote:
yes i save graphics from g, where g is printscreen from rectangle where i put picture box. So if i put picturebox top left with height 50 and width 50, it will save it top left screen(it take picture from picturebox). If i put middle of screen so it will take it too. But with lambda expresion, it take picture from somewhere i dont know because it is only grey area...
Ok I changed it a little bit, however same idea. So that you know what image you're getting, I have the image saved to your desktop
Code: Select all
        Invoke(
            DirectCast(
                Sub()
                    Using bmp = New Bitmap(CameraView.Width, CameraView.Height)
                        Using g = Graphics.FromImage(bmp)
                            Dim sourcePoints = CameraView.PointToScreen(New Point(CameraView.ClientRectangle.X,
                                                                                  CameraView.ClientRectangle.Y))
                            g.CopyFromScreen(sourcePoints, Point.Empty, CameraView.Size, CopyPixelOperation.SourceCopy)
                            bmp.Save(My.Computer.FileSystem.SpecialDirectories.Desktop + "\pic.bmp", ImageFormat.Bmp)
                  End Using
                  End Using
                  End Sub,
                MethodInvoker))
11 posts Page 2 of 2
Return to “Coding Help & Support”