这有点复杂,但我想截取屏幕截图,并保存它。但是当我保存相同的时候,我想覆盖它,但我的编码不起作用。
我想知道是否有人知道我做错了什么:
Dim bmpScreenShot As Bitmap
Dim gfxScreenshot As Graphics
bmpScreenShot = New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
gfxScreenshot = Graphics.FromImage(bmpScreenShot)
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy)
MessageBox.Show("This will save the log as a screenshot in the 'S' Drive (S:/), please make sure that this drive has been mapped in your network.", "Log Saving", MessageBoxButtons.OK, MessageBoxIcon.Information)
If System.IO.File.Exists("S:\My Behaviour Logs\Incident Details.bmp") Then
bmpScreenShot.Save("S:\My Behaviour Logs\Incident Details.jpeg", Imaging.ImageFormat.Jpeg)
System.IO.File.Replace("S:\My Behaviour Logs\Incident Details.bmp", "S:\My Behaviour Logs\Incident Details.jpeg", "S:\My Behaviour Logs\Incident Details.jpeg")
If (Not System.IO.Directory.Exists("S:\My Behaviour Logs")) Then
System.IO.Directory.CreateDirectory("S:\My Behaviour Logs")
End If
End If
如果有人知道我做错了什么,请说。
谢谢