Private _theFocusPen As Pen = Nothing
Private _xOffset As Integer = 0
Private _yOffset As Integer = 0
Private _wOffset As Integer = 0
Private _hOffset As Integer = 0
Public Sub New(ByVal theFocusPen As Pen, ByVal xOffset As Integer, ByVal yOffset As Integer, ByVal wOffset As Integer, ByVal hOffset As Integer)
_theFocusPen = theFocusPen
_xOffset = xOffset
_yOffset = yOffset
_wOffset = wOffset
_hOffset = hOffset
End Sub
Public Function DrawElement(ByVal drawPhase As Infragistics.Win.DrawPhase, ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Boolean Implements Infragistics.Win.IUIElementDrawFilter.DrawElement
Dim retVal As Boolean = False
If drawPhase = Infragistics.Win.DrawPhase.BeforeDrawFocus Then
Dim regularRect As Rectangle = drawParams.Element.Rect
Dim clippedRect As Rectangle = drawParams.Element.ClipRect
Dim theFocusRectangle As Rectangle
If (clippedRect.Width < regularRect.Width) OrElse (clippedRect.Height < regularRect.Height) Then
theFocusRectangle = clippedRect
Else
theFocusRectangle = regularRect
End If
theFocusRectangle = New Rectangle(theFocusRectangle.X + _xOffset, theFocusRectangle.Y + _yOffset, theFocusRectangle.Width + _wOffset, theFocusRectangle.Height + _hOffset)
drawParams.Graphics.DrawRectangle(_theFocusPen, theFocusRectangle)
retVal = True
End If
Return retVal
End Function