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.

DrawCellBackground

Thread ID:

Created:

Updated:

Platform:

Replies:

23576 Jan 14,2005 10:04 AM Jan 18,2005 12:45 AM Windows Forms 5
loading
Tags: GridControl
Steve
Asked On January 14, 2005 10:04 AM

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 10:21 AM

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

Steve
Replied On 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

Administrator [Syncfusion]
Replied On 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;

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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.)

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.

;