Private Sub WebView22_Click(sender As Object, e As EventArgs) Handles WebView22.Click
grabpic()
End Sub
Public Async Function grabpic() As Threading.Tasks.Task
Dim ms As System.IO.Stream
Await (WebView22.CoreWebView2.CapturePreviewAsync(CoreWebView2CapturePreviewImageFormat.Jpeg, ms))
Dim file As New System.IO.FileStream("C:\temp\test.jpg", IO.FileMode.Create)
ms.CopyTo(file)
ms.Close()
End Function
Public Async Function grabpic() As Task
Using ms As New IO.MemoryStream()
Await WebView22.CoreWebView2.CapturePreviewAsync(
CoreWebView2CapturePreviewImageFormat.Jpeg, ms)
Using file As New IO.FileStream("C:\temp\test.jpg", IO.FileMode.Create)
ms.Seek(0, IO.SeekOrigin.Begin)
ms.CopyTo(file)
End Using
End Using
End Function