Version

DrawFocus Method (UIElement)

Default drawfocus method draws a focus rect inside the element's borders
Syntax
'Declaration
 
Protected Overridable Sub DrawFocus( _
   ByRef drawParams As UIElementDrawParams _
) 
protected virtual void DrawFocus( 
   ref UIElementDrawParams drawParams
)

Parameters

drawParams
The UIElementDrawParams used to provide rendering information.
Example
This sample overrides the virtual method DrawFocus off of UIElement. Here we use ControlPaint to draw a focus rectangle around the specified rect.

Imports Infragistics.Win

 Protected Overrides Sub DrawFocus(ByRef drawParams As UIElementDrawParams)

' Get the rect inside bounding border.
     Dim rect As Rectangle = me.RectInsideBorders 

' Draw the focus rectangle using the ControlPaint class.
     ControlPaint.DrawFocusRectangle(drawParams.Graphics, _ 
	rect, drawParams.AppearanceData.GetForeColor(Me.Enabled), _
	drawParams.AppearanceData.GetBackColor(Me.Enabled))

 End Sub
using Infragistics.Win;
protected override void DrawFocus(ref UIElementDrawParams drawParams)
{

	// Get the rect inside bounding border.
	Rectangle rect = this.RectInsideBorders;

	// Draw the focus rectangle using the ControlPaint class.
	ControlPaint.DrawFocusRectangle(drawParams.Graphics,
										rect,drawParams.AppearanceData.GetForeColor(this.Enabled),
										drawParams.AppearanceData.GetBackColor(this.Enabled));

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also