I need to repaint a specific cell in my grid, but can't work out the correct way to do it. The reason is because some columns have been hidden and some reordered. What is the correct way to repaint a cell if you know the original column number?
grid.RepaintCell(col,row) should do this.
grid.RepaintCell seems to use the currently visible column and row, which is understandable.
The cells I'm updating are accessed using the OriginalCells method.
I can use grid.RepaintRow but was trying to avoid repainting more than I needed to.
For column moving, there is information in the PDF developers guide on page 146, for working with hidden columns this is covered on page 141:
I've read that several times and tried various things, but have never worked it out. It would be nice if there were a way to deal with the columns via a simple method.
when you want to redraw the cell what you need to do?
Change cell color, text ecc..
You can work on others grid arraies, for example Colors and Fonts.
These arraies works on real index and does not take care about hidden rows or columns because cover all grid coordinates.
For example, if you have a grid with 10 columns with 50 rows and hide column 5, if you use
you don't se anything.
But if you unhide column 5 the cell in col 5 and row 5 has red color.
The same for Font.
For text is a little different because, when you have some hidden rows/columns, you can work in different way.
I prefer to work with "global" coordinates using grid.cell[C,R] to set the text without take care what is hide or not; If i change a text in a hiddn cell ... the modified text will not be showed ... differently yes.
At the end, if you move and change column position (so you move column 5 to column 7) you have to make a choice.
The first is want to update the original column 5 (now in 7th positon) or, second one, you want to update the new column 5 (now column 6, shifted to left and replaced 5th position) ? .
In this case i prefer to use the "real" coordinate in order to update the rigth column ...using ColumnPosition(5) that update the REAL column 5 in any new position it is.
Obviously the hide/unhide operation will beGrid.HideColumn(Grid.ColumnPosition(5)).
Sorry for long reply ... and If this is not your case, please do not consider this ..
I'll have to look into this some more. I must be missing something.
One issue I'm having is that when I update the cell's text at a rapid rate (every 100ms for a timing function display), the changes are not seen unless I repaint the cell or row.
Repainting the whole row works, but I was hoping to minimise CPU usage as there are a lot of other things going on in my application.
With this limited information, it is unclear why single cell repaint is not working.
We cannot see an issue with that here.
I suggest to isolate this issue and provide a sample source project with which we can reproduce this issue.
try to see the attached test, if i understood the problem.
It's update the cell (hidden or not) color manually or random (every 100 ms).
Test.zip (27.6 KB)
Hope can help you ...
I couldn't compile that project sorry. Maybe it's meant for something way newer than XE. Thanks anyway.