1
我在vb.net 2010使用下面的代碼創建一個屏幕捕獲工具:在應用程序的路徑如何保存JPG文件在我的文檔/ Screentshot在vb.net 2010
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim snappit As String = 0
TextBox1.Text -= snappit + 1
If TextBox1.Text = 0 Then
Me.Hide()
End If
If TextBox1.Text = -2 Then
Try
Dim screenshot 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)
g.CopyFromScreen(New Point(0, 0), New Point(0, 0), screenshot)
screengrab.Save("snap.jpg")
MsgBox("your screen has been snapped and the snap was saved", MsgBoxStyle.Information, "ScreenShot")
Me.Show()
Timer2.Stop()
TextBox1.Text = 3
Catch ex As Exception
MsgBox("sorry unable to snap your screen and save at the moment please try again later", MsgBoxStyle.Critical, "Warning!")
End Try
End If
End Sub
此代碼存儲snap.jpg文件但我想它存儲在 我的文檔/截圖
所以我用
Dim SnapDir As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\Screenshot\"
是和嘗試移動JPG文件中snapdir但不能sucess ...
所以如何保存JPG文件snapdir或如何保存使用SaveFileDialog的dir是JPG文件...
感謝
和英語不好對不起......
可能的重複[如何在vb.net中使用savefiledialog](http://stackoverflow.com/questions/15169531/h OW-DO-使用-savefiledialog式-VB網) – Plutonix