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.
Unfortunately, activation email could not send to your email. Please try again.

GGC: Getting group position

Thread ID:

Created:

Updated:

Platform:

Replies:

37222 Nov 17,2005 11:28 AM Nov 17,2005 12:14 PM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 17, 2005 11:28 AM

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 12:14 PM

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.

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.

;