We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC: Getting group position

Thread ID:

Created:

Updated:

Platform:

Replies:

37222 Nov 17,2005 04:28 PM UTC Nov 17,2005 05:14 PM UTC WinForms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 17, 2005 04:28 PM UTC

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.

Administrator [Syncfusion]
Replied On 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;
			}
		}
	}
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;