VB.net.beginner
New member
- Joined
- Oct 18, 2022
- Messages
- 3
- Programming Experience
- 10+
I have used this subroutine for screen capture of forms on Windows 7 with VS 2019. When I started using this on Windows 10, the locations are messed up. The left of the Form is a lot of pixels to the right of the image captured. Is there a good solution or workaround which does not need a lot of new code?
Then it is called simply as
Call SaveFromScreen(Me, filN)
The screen is 1920 x 1080. Earlier ones were smaller. Could this be one of the reasons?
VB.net:
Sub SaveFromScreen(frm As Form, filn As String)
Dim img As New Bitmap(frm.ClientSize.Width, frm.ClientSize.Height)
Using gr As Graphics = Graphics.FromImage(img)
gr.CopyFromScreen(frm.PointToScreen(frm.ClientRectangle.Location), Point.Empty, frm.ClientSize)
End Using
img.Save(filn, Imaging.ImageFormat.Png)
End Sub
Then it is called simply as
Call SaveFromScreen(Me, filN)
The screen is 1920 x 1080. Earlier ones were smaller. Could this be one of the reasons?