繼承人vb.net中的位圖圖像保存代碼片段。有人可以幫我理解爲什麼我在這裏得到一個錯誤,指出我想在保存圖像時將字符串轉換爲double。如何糾正?vb.net中的類型轉換錯誤
Private Sub Timer5_Tick(sender As System.Object, e As System.EventArgs) Handles Timer5.Tick
x = MyRandomNumber.Next(1000)
screenWidth = Screen.GetBounds(New Point(0, 0)).Width
screenHeight = Screen.GetBounds(New Point(0, 0)).Height
Dim bmpScreenShot As New Bitmap(screenWidth, screenHeight)
Dim gfx As Graphics = Graphics.FromImage(bmpScreenShot)
gfx.CopyFromScreen(0, 0, 0, 0, New Size(screenWidth, screenHeight))
***bmpScreenShot.Save("D:\\screenshots\\" + x + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)***
End Sub
修復了轉換問題後,您可能希望將雙斜槓'\\'更改爲單斜槓'\'...因爲只有C#中需要雙重斜槓,而不是VB.NET – freefaller