Infragistics(R) NetAdvantage(R) Windows Forms
DrawFocus Method
See Also  Example E-mail your feedback on this topic.
Infragistics.Win Namespace > UIElement Class : DrawFocus Method

drawParams
The UIElementDrawParams used to provide rendering information.
Default drawfocus method draws a focus rect inside the element's borders

Syntax

Visual Basic (Declaration) 
Protected Overridable Sub DrawFocus( _
   ByRef drawParams As UIElementDrawParams _
) 
C# 
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.

Visual BasicCopy Code
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
C#Copy Code
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));

}

See Also