Themes ignored in GridControl static cell when displaying image

Hi.

I am displaying an icon in the row header cell, but have found that the Theme is being ignored when the CellType is "Static".
My grid has ThemesEnabled set to true.
I am using version 4.1.0.50.

I have created an imagelist and set the BaseStylesMap["Standard"].StyleInfo.ImageList to my imagelist.

I then created a new GridStyleInfo (gsi) pointing to cell [1, 0].
I set gsi.CellType = "Static" and gsi.ImageIndex = 1, and my image does appear in the cell.

The problem is, the cell colour/style has changed back to the default row header colour.
I would have expected the cell to retain the XP Theme it had before the image was applied.

Is there any way to keep the theme and display the image?

Thanks,
-Stephen

2 Replies

HA haneefm Syncfusion Team July 10, 2007 11:35 PM UTC

Hi Stephen,

One thing you can do is to handle the CellDrawn event, and if it is the current rowheader that has been drawn, then draw your bitmap over it. Here is code that assume the image you want to use is 0th entry in the ImageList, this.imageList1.

private void grid_CellDrawn(object sender, GridDrawCellEventArgs e)
{
if(e.ColIndex == 0 && e.RowIndex >0 )
{
Rectangle rect = GridUtil.CenterInRect(e.Bounds, this.imageList1.ImageSize);
GridStaticCellRenderer.DrawImage(e.Graphics, this.imageList1, 0, rect, false);
}
}

Best regards,
Haneef


ST Stephen Trinder July 13, 2007 05:05 AM UTC

Hi Haneef.

That's works great, thanks for your help.

-Stephen

Loader.
Up arrow icon