WebView.CapturePreviewToStreamAsync(IRandomAccessStream) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
virtual IAsyncAction ^ CapturePreviewToStreamAsync(IRandomAccessStream ^ stream) = CapturePreviewToStreamAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction CapturePreviewToStreamAsync(IRandomAccessStream const& stream);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction CapturePreviewToStreamAsync(IRandomAccessStream stream);
function capturePreviewToStreamAsync(stream)
Public Function CapturePreviewToStreamAsync (stream As IRandomAccessStream) As IAsyncAction
Parameters
- stream
- IRandomAccessStream
The stream to write the image to.
Returns
An asynchronous action to await the capture operation.
- Attributes
Examples
This example shows how to use this method to create a thumbnail image of the current content. For the complete example, see the WebView control sample.
private async void bookmarkBtn_Click(object sender, RoutedEventArgs e)
{
InMemoryRandomAccessStream ms = new InMemoryRandomAccessStream();
await webView8.CapturePreviewToStreamAsync(ms);
// Create a small thumbnail.
int longlength = 180, width = 0, height = 0;
double srcwidth = webView8.ActualWidth, srcheight = webView8.ActualHeight;
double factor = srcwidth / srcheight;
if (factor < 1)
{
height = longlength;
width = (int)(longlength * factor);
}
else
{
width = longlength;
height = (int)(longlength / factor);
}
BitmapSource small = await resize(width, height, ms);
BookmarkItem item = new BookmarkItem();
item.Title = webView8.DocumentTitle;
item.PageUrl = webView8.Source;
item.Preview = small;
bookmarks.Add(item);
}
Applies to
See also
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin