Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
' Implement the IUIElementDrawFilter interface on a class
' (in this case the form)
PublicClass Form1
Inherits System.Windows.Forms.Form
Implements Infragistics.Win.IUIElementDrawFilter
Private borderPen As System.Drawing.Pen
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
' Set the grid’s DrawFilter property to the object that
' implements the IUIElementDrawFilter interface.
Me.UltraGrid1.DrawFilter = Me' Create a pen to use in the filter
Me.borderPen = New Pen(Color.DarkGoldenrod)
End SubPublicFunction GetPhasesToFilter(ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Infragistics.Win.DrawPhase Implements Infragistics.Win.IUIElementDrawFilter.GetPhasesToFilter
' If the element being drawn is a RowCellAreaUIElement we're interested in
' drawing its borders only.
If (TypeOf (drawParams.Element) Is RowCellAreaUIElement) ThenReturn Infragistics.Win.DrawPhase.BeforeDrawBorders
ElseReturn Infragistics.Win.DrawPhase.None
EndIfEnd FunctionPublicFunction DrawElement(ByVal drawPhase As Infragistics.Win.DrawPhase, ByRef drawParams As Infragistics.Win.UIElementDrawParams) AsBooleanImplements Infragistics.Win.IUIElementDrawFilter.DrawElement
' This will only be called for the BeforeDrawBorders phase of a
' RowCellAreaUIElement based on the flags returned from GetPhasesToFilter.
Dim elementRect As Rectangle
' Get the element's rect
elementRect = drawParams.Element.Rect
' Draw a border along the top edge of the element.
drawParams.Graphics.DrawLine(Me.borderPen, _
elementRect.Location, _
New Point(elementRect.Right, elementRect.Top))
' Return true to prevent the element from drawing its borders normally.
ReturnTrueEnd Function
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
// Implement the IUIElementDrawFilter interface on a class
// (in this case the form)
publicclass Form1 :
System.Windows.Forms.Form,
Infragistics.Win.IUIElementDrawFilter
{
private System.Drawing.Pen borderPen;
privatevoid Form1_Load(object sender, System.EventArgs e)
{
// Set the grid’s DrawFilter property to the object that
// implements the IUIElementDrawFilter interface.
this.ultraGrid1.DrawFilter = this;
// Create a pen to use in the filter
this.borderPen = new Pen(Color.DarkGoldenrod);
}
public Infragistics.Win.DrawPhase GetPhasesToFilter(ref Infragistics.Win.UIElementDrawParams drawParams)
{
// If the element being drawn is a RowCellAreaUIElement we're interested in
// drawing its borders only.
if (drawParams.Element is RowCellAreaUIElement)
return Infragistics.Win.DrawPhase.BeforeDrawBorders;
elsereturn Infragistics.Win.DrawPhase.None;
}
publicbool DrawElement(Infragistics.Win.DrawPhase drawPhase, ref Infragistics.Win.UIElementDrawParams drawParams)
{
// This will only be called for the BeforeDrawBorders phase of a
// RowCellAreaUIElement based on the flags returned from GetPhasesToFilter.
// Draw a border along the top edge of the element.
Rectangle elementRect = drawParams.Element.Rect;
drawParams.Graphics.DrawLine( this.borderPen,
elementRect.Location,
new Point(elementRect.Right, elementRect.Top));
// Return true to prevent the element from drawing its borders normally.
returntrue;
}