Images and Text in the same column in Grouping Grid Control

hi,

I have to put image and text in the same column of the grid grouping control. Can you guys suggest any approach.

4 Replies

GR Golda Rebecal Syncfusion Team October 2, 2007 02:16 AM UTC

Hi Venkat,

I regret for the long delay in responding.

You can achieve this requirement by handling the QueryCellStyleInfo to set the image index to the required cells of a particular column based on the cellvalue and TabeControlDrawCellDisplayText event to cancel the drawing of text in those cells.

Please refer to the attached sample that illustrates the same:
http://websamples.syncfusion.com/samples/Grid.Windows/F68645/main.htm

Kindly let me know if this helps you.

We appreciate your interest in Syncfusion products.

Best regards,
Golda


VA Venkat Akella October 23, 2007 03:37 PM UTC

Actually i want to have image and Text in same column of the grid grouping control. Can you suggest how can i achieve this?


VA Venkat Akella October 23, 2007 03:38 PM UTC

i want have image and text in same column cell of the Grid Grouping control. can you suggest an approach?


JS Jeba S Syncfusion Team December 26, 2007 11:39 AM UTC

Hi Venkat,

Sorry for the delay in response.

Another way to achieve images and text in the same column in GroupingGridControl by handling the TableControlCellDrawn. In this event handler using the DrawImage method you can draw the image in the column that contains text.

Below is the code snippets:

private void gridGroupingControl1_TableControlCellDrawn(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
Rectangle iconBounds;
if (style.TableCellIdentity.ColIndex == 1 && style.TableCellIdentity.RowIndex >=4 )
{
iconBounds = Rectangle.FromLTRB(e.Inner.Bounds.Right - 18, e.Inner.Bounds.Top, e.Inner.Bounds.Right, e.Inner.Bounds.Bottom);
GridStaticCellRenderer.DrawImage(e.Inner.Graphics, this.images, 1, iconBounds, false);
e.Inner.Cancel = true;
}
}



Please refer the sample which illustrates the above said feature:
http://websamples.syncfusion.com/samples/Grid.Windows/F68645Second/main.htm

Kindly let us know if you need any further assistance.

Best Regards,
Jeba.





Loader.
Up arrow icon