Image in GroupCaptionCell

Syncfusion 4.4
VS 2005

I want to add an image(like an alert icon) to the GroupCaptionCell if a record in that group meets a specific criteria and then also set the image for the group's parent group groupcaptioncell.

Can someone help with this? Thanks

1 Reply

HA haneefm Syncfusion Team May 2, 2007 10:40 PM UTC

Hi Shek,

If you want to draw the Exclamation mark on GroupCaption cell, you need to handle the TableControlDrawCell event of the grid and draw image using the Graphics.DrawImage method. Here is a code snippet.

private void gridGroupingControl1_TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
if( style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell )
{
Element el = style.TableCellIdentity.DisplayElement;
if( ! el.ParentGroup.IsMainGroup )
{
object category = el.ParentGroup.Category;
if( category != null)
{
e.Inner.Cancel = true;
Rectangle ImageRect= new Rectangle(e.Inner.Bounds.Location,new Size(20,e.Inner.Bounds.Height));
Rectangle TextRect= new Rectangle( new Point( e.Inner.Bounds.Location.X + 20,e.Inner.Bounds.Location.Y),
new Size(e.Inner.Bounds.Size.Width- 20,e.Inner.Bounds.Height));

e.Inner.Renderer.Draw(e.Inner.Graphics,TextRect,e.Inner.RowIndex,e.Inner.ColIndex,e.Inner.Style);
e.Inner.Graphics.DrawImage(SystemIcons.Exclamation.ToBitmap(),ImageRect);
}
}
}
}

Please refer to the attached sample for implementation.
GGCGroupCAtionImage.zip

Best regards,
Haneef

Loader.
Up arrow icon