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.

Themes ignored in GridControl static cell when displaying image

Thread ID:

Created:

Updated:

Platform:

Replies:

63859 Jul 10,2007 07:29 PM Jul 13,2007 01:05 AM Windows Forms 2
loading
Tags: GridControl
Stephen Trinder
Asked On July 10, 2007 07:29 PM

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

haneefm [Syncfusion]
Replied On July 10, 2007 07:35 PM

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

Stephen Trinder
Replied On July 13, 2007 01:05 AM

Hi Haneef.

That's works great, thanks for your help.

-Stephen

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.

;