Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
620
How to stop a row from redrawing until all changes are complete
posted

The following two lines of code cause flickering (text jumps from black to white to black again).

row.Band.Layout.Grid.DisplayLayout.Override.ActiveRowAppearance.Reset();
row.Band.Layout.Grid.DisplayLayout.Override.ActiveRowAppearance.ForeColor = Color.Black;

Is there some way of telling the row NOT to redraw itself immediately after the Reset()?

I was trying BeginUpdate/EndUpdate on the grid level, but that is for data changes.

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi,

    kennethknoepfli said:
    I was trying BeginUpdate/EndUpdate on the grid level, but that is for data changes.

    This is not correct. BeginUpdate and EndUpdate are specifically to tell the control not to paint. They have nothing to do with changes to the data.

    I ran your sample and I see that there is a tiny flicker sometimes when I click on the George Harrison row. But I don't see a problem on any other row.

    The reason for the flickering is that the row is activated and selected before the MouseDown event fires. So the row is getting highlighted and then you change the color.This explains why BeginUpdate/EndUpdate did not help - because you were probably calling BeginUpdate in the MouseDown event and it is already too late by then.

    SuspendLayout will not help at all, since that method is related to laying out child controls and has nothing to do with what you are doing.

    I'm not really sure exactly what you are trying to do here or why you are chaning the ActiveRowAppearance. Do you need to apply a different appearance to the ActiveRow based on some other factor? Your sample is not doing that, but maybe you are doing it in your real application?

    If not, then you only need to set the ActveRowAppearance once, you don't need to keep setting it over and over every time the active row changes. 

    If that's no good, then maybe you should be using the Before/AfterRowActivate events to deal with this instead of MouseDown. MouseDown doesn't really make sense anyway, because the user could change the active or selected rows via the keyboard. Of course, your comments here mention drag and drop, so maybe that's no good either.

    It's hard to offer you any more useful advice without knowing exactly what your requirements are.

Reply Children
No Data