Partager via


WebBrowserBrush.Redraw Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Forces the brush to asynchronously redraw itself.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Sub Redraw
public void Redraw()

Remarks

The Redraw method forces the brush to asynchronously redraw itself. The contents of the WebBrowser will be captured at the time of the Redraw call and Silverlight will update the brush at the next opportunity. If the WebBrowser contains content that is continuously changing, such as video content, you will need to call Redraw regularly to update the WebBrowserBrush.

Examples

The following example shows how to use the Redraw method. In this example, the WebBrowserBrush updates its content when the user moves the mouse.

Private Sub LayoutRoot_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseEventArgs)
    WBB1.Redraw()
End Sub
private void LayoutRoot_MouseMove(object sender, MouseEventArgs e)
{
    WBB1.Redraw();
}
<StackPanel x:Name="LayoutRoot" Background="Blue" MouseMove="LayoutRoot_MouseMove">
    <WebBrowser Name="WB1" Source="Hello.html" Height="150" Width="150" />
    <Rectangle Height="150" Width="150" >
        <Rectangle.Fill>
            <WebBrowserBrush SourceName="WB1" Opacity=".5" x:Name="WBB1"/>
        </Rectangle.Fill>
    </Rectangle>
</StackPanel>

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.