Re: TStringGrid.DrawCell - Not Updating The Correct Cell



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



Relevant Pages

  • Re: How to debug a compiled exe
    ... I killed all DoEvents and replaced them with Sleep where necessary. ... My problem was that I was doing long doevent loops in which the app could do other things that it wanted to do. ... You can click on a cell in the grid, ... While it was still scrolling, ...
    (microsoft.public.vb.general.discussion)
  • Re: SplitScreen
    ... that uses PictureBox controls for the divider bars, ... eliminates a few controls. ... A question on the synchronized scrolling - it appears that a FlexGrid will ... I want to use a single scrollbar (on grid 3) without others showing ...
    (microsoft.public.vb.controls)
  • Re: APP behaves differently in IDE vs EXE
    ... The app is using the dbgrid32 control as an unbound grid. ... Since I've added the line to set the bookmark property to ... scrolling issue, I'd appreciate hearing them. ...
    (microsoft.public.vb.general.discussion)
  • Re: Forcing datagrid to expand horizontally instead of vertically
    ... Teemu Keiski ... up way too much horizontal space. ... Is there a way to limit the height of the grid or of the rows ... I've seen some examples of using divs with scrolling, ...
    (microsoft.public.dotnet.framework.aspnet)
  • ANN: TAdvStringGrid v3.0 released
    ... We're excited to announce the release of the new TAdvStringGrid v3.0 at ... copies grid as HTML on the clipboard ... Support for background display over full background, ... Filter selection to filter on virtual cell text or grid cells text ...
    (borland.public.delphi.thirdpartytools.general)