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

DrawCellBackground

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

5 Replies

AD Administrator Syncfusion Team January 14, 2005 10:21 AM

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


ST Steve January 17, 2005 08:37 AM

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


AD Administrator Syncfusion Team January 17, 2005 09:33 AM

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;


AD Administrator Syncfusion Team January 17, 2005 07:52 PM

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


AD Administrator Syncfusion Team January 18, 2005 12:45 AM

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.)

Loader.
Live Chat Icon For mobile
Up arrow icon