0

hi ol
my name is yasin and am currently working on this application that is an assignment for my diploma.
i am creating the application in vbnet 2003
One of the tasks in the assignment is to capture and save the image on the form. I got this piece of code but the problem is that it was written in vbnet 2005 .

Dim ScreenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim screenGrab As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screenGrab)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
g.CopyFromScreen(New Point(0, 0), New Point(0, 0), ScreenSize)
'screenGrab.Save("C:\screenGrab.bmp")
screenGrab.Save("C:\screenGrab.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub

can anyone help as i just started programming in vbnet 2003 a few months ago. dont have much experience.

thank you

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by waynespangler
0

I have not used vb 2003 but I think all you have to change is:

My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height

to

Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.