Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Border.OnRender Method

Draws the contents of a DrawingContext object during the render pass of a Border.

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

'Declaration
Protected Overrides Sub OnRender ( _
	dc As DrawingContext _
)

Parameters

dc
Type: System.Windows.Media.DrawingContext

The DrawingContext that defines the object to be drawn.

This example shows how to override the OnRender method of Panel in order to add custom graphical effects to a layout element.

Use the OnRender method in order to add graphical effects to a rendered panel element. For example, you can use this method to add custom border or background effects. A DrawingContext object is passed as an argument, which provides methods for drawing shapes, text, images, or videos. As a result, this method is useful for customization of a panel object.

			' Override the OnRender call to add a Background and Border to the OffSetPanel
			Protected Overrides Sub OnRender(ByVal dc As DrawingContext)
				Dim mySolidColorBrush As New SolidColorBrush()
				mySolidColorBrush.Color = Colors.LimeGreen
				Dim myPen As New Pen(Brushes.Blue, 10)
				Dim myRect As New Rect(0, 0, 500, 500)
				dc.DrawRectangle(mySolidColorBrush, myPen, myRect)
			End Sub

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft