GGC: Getting group position

Is there anyway to determine whether or not you are the first or last row in a group in the TableControlCellDrawn. I am trying to draw a different graphic for the first vs last vs any middle row within a group in the indent. I have the graphic in the indent fine but I want to display a different graphic if it is the first member or the last.

1 Reply

AD Administrator Syncfusion Team November 17, 2005 05:14 PM UTC

Here is a try at this.
private void gridGroupingControl1_TableControlCellDrawn(object sender, GridTableControlDrawCellEventArgs e)
{
	GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
	if(style.TableCellIdentity.TableCellType == GridTableCellType.GroupIndentCell) 
	{
		if(style.TableCellIdentity.DisplayElement is GridRecordRow)
		{
			using(Brush b = new SolidBrush(Color.Red))
			{
				GridRecordRow rec = style.TableCellIdentity.DisplayElement as GridRecordRow;
				int i = rec.ParentGroup.Records.IndexOf(rec.ParentRecord);
				e.Inner.Graphics.DrawString(i.ToString(), style.GdipFont, b, 
					e.Inner.Bounds.X + 2, e.Inner.Bounds.Y + 2);
				e.Inner.Cancel = true;
			}
		}
	}
}

Loader.
Up arrow icon