Re: TStringGrid.DrawCell - Not Updating The Correct Cell
- From: erewhon@xxxxxxxxxx (J French)
- Date: Fri, 31 Mar 2006 08:27:54 GMT
On 30 Mar 2006 13:51:49 -0800, cyberonix@xxxxxxxxxxx wrote:
Actually I never could figure out how to do it through code. I finally
ended up using two grids. One was visible and the other invisible.
Instead of scrolling the visible grid I scrolled the invisible grid
instead and did a TextOut to paint the invisible grid's text contents
to the visible control. That way the visible control never actually
scrolled but it looked like it did as the TextOut updated its
appearance. Voila... the center "highlighted" cell never actually moved
and so I got no ghosting.
I looked into this earlier
- unfortunately my system date got altered so my post did not show up
Your problem is down to the Grid using the ScrollWindow API
- which literally scrolls the window
Then the TopLeftChanged fires
Then the Grid asks for the newly revealed cells to be updated
By telling it to refresh all the cells you are generating quite a lot
of work, it would be a lot more efficient 'remembering' the red row
number and refreshing those first then let the Grid ask for a refresh
of the newly visible cells
You also might get some joy from using WM_SETREDRAW
<quote>
This message sets or clears the redraw flag. If the redraw flag is
cleared, the content of the given window is not updated after each
change, and the window is not repainted until the redraw flag is set.
For example, an application that must add several items to a list box
can clear the redraw flag, add the items, and then set the redraw
flag. Finally, the application can call the InvalidateRect function to
cause the list box to be repainted.
</quote>
If that looks good then I would make a descendant of the TStringGrid
with updating controlled 'internally'
.
- References:
- TStringGrid.DrawCell - Not Updating The Correct Cell
- From: cyberonix
- Re: TStringGrid.DrawCell - Not Updating The Correct Cell
- From: cyberonix
- Re: TStringGrid.DrawCell - Not Updating The Correct Cell
- From: cyberonix
- Re: TStringGrid.DrawCell - Not Updating The Correct Cell
- From: alanglloyd@xxxxxxx
- Re: TStringGrid.DrawCell - Not Updating The Correct Cell
- From: cyberonix
- TStringGrid.DrawCell - Not Updating The Correct Cell
- Prev by Date: Re: Include DLL's within an EXE
- Next by Date: Re: Include DLL's within an EXE
- Previous by thread: Re: TStringGrid.DrawCell - Not Updating The Correct Cell
- Next by thread: Internet application - what port should I use?
- Index(es):
Relevant Pages
|