Jump to content


Photo

OnCellColoring problem


  • Please log in to reply
2 replies to this topic

#1 Jordan

Jordan
  • Members
  • 14 posts

Posted 18 July 2009 - 12:31 AM

I have started using the OnCellColoring event, and for one of my applications, the event is triggered with a Row value that is equal to RowCount, causing an index out of bounds exception when I use that value. I had to place a test for this condition in the event code:

CODE
  if ARow >= TheGrid.RowCount then
    exit;
... actual code to set colors


The safety check seems to work fine, but I have to remember to include it in all my event handlers.

Has this problem been reported before?


#2 Jordan

Jordan
  • Members
  • 14 posts

Posted 18 July 2009 - 12:35 AM

QUOTE (Jordan @ Jul 17 2009, 07:31 PM) <{POST_SNAPBACK}>
I have started using the OnCellColoring event, and for one of my applications, the event is triggered with a Row value that is equal to RowCount, causing an index out of bounds exception when I use that value. I had to place a test for this condition in the event code:

CODE
  if ARow >= TheGrid.RowCount then
    exit;
... actual code to set colors


The safety check seems to work fine, but I have to remember to include it in all my event handlers.

Has this problem been reported before?


I found this earlier post that seems to answer my question:

http://www.bergsoft....=oncellcoloring

Is there a way to suppress the drawing of inactive rows. I would like to have grid lines, but only for the active rows, and so far, I haven't been able to do that.

#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 18 July 2009 - 10:49 AM

Hello Jordan,

This is a way how grid work. This approach give a possibility to colorize rows that are "empty" which may give very nice results.

To enable grid lines for only active rows, set GridLinesStyle property to lsActiveRows. I hope that this is what you need.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users