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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





23576 Jan 14,2005 03:04 PM UTC Jan 18,2005 05:45 AM UTC WinForms 5
Tags: GridControl
Asked On January 14, 2005 03:04 PM UTC

According to the documentation, the DrawCellBackground event should fire each time the background of a specified cell is drawn. How can I determine that specific cell that is being drawn in this event? When I look at the range object I do not get a specific cell but header cells. Please see attached example. Thanks, Steve GridDrawCellBackground_6633.zip

Administrator [Syncfusion]
Replied On January 14, 2005 03:21 PM UTC

Try e.Style.CellIdentity.RowIndex, e.Style.CellIdentity.ColIndex.

Replied On January 17, 2005 01:37 PM UTC

I modified the example with your suggestion (see attached), but not all cells are included. The listbox should have every cell that was drawn, but cell 2,2 (and others) are not included. Thanks, Steve GridDrawCellBackground2_4027.zip

Administrator [Syncfusion]
Replied On January 17, 2005 02:33 PM UTC

For optimization purposes, DrawCellBackGround is not raised unless you explicitly tell the grid that you want it rasied. To tell the grid to raise this event, you set the style.Interior property of desired cells to be the empty brushinfo, Syncfusion.Drawing.BrushInfo.Empty. This will force the event to be raised for all cells. this.gridControl1.TableStyle.Interior = Syncfusion.Drawing.BrushInfo.Empty;

Administrator [Syncfusion]
Replied On January 18, 2005 12:52 AM UTC

Thanks Clay. Your suggestion works except for the fact that if I set the background color in queryCellInfo it does not fire. I will change to not do this, but I am curious as to well setting the background color prevents the event from firing. Thanks

Administrator [Syncfusion]
Replied On January 18, 2005 05:45 AM UTC

Setting style.BackColor changes style.Interior (it is really style.Interior that defines the cell''s backcolor as it specifies the brush used to draw it. The grid internally tracks changes in style.BackColor to set the BrushInfo assigned to style.Interior.)


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon