using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
// Implement the IUIElementDrawFilter interface on a class
// (in this case the form)
public class Form1 : System.Windows.Forms.Form,
Infragistics.Win.IUIElementDrawFilter
{
Pen borderPen = new Pen(Color.DarkGoldenrod);
private void 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;
}
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;
else
return Infragistics.Win.DrawPhase.None;
}
public bool 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.
return true;
}
}