Cell / row invalidate causes application lag
Hi, we are using the grid to show latest transaction and the latest transaction background should be highlighted.
We are not using provided highlight features.
We are doing it in PaintCell event, and set the cell background to certain color.. but when we call cell/row invalidate it causes the application lag.
following is the sample app of the issue above.
p/s:
Using Dapfor Highlight sample as the main app. Bottom of the main app has 2 button to open the respective sample form.
Using Dapfor.Net.dll ver 2.4.0.36246 .. referenced in lib folder. but it have been remove it before archived.
WindowsFormsApplication1.zip
-
Hi,
Your example won’t work because you call Control.Invalidate() method inside of Control.OnPaint() message handler. You will also have an impact on the windows timer – it won’t work properly. We suggest you other solution:
1. Set highlighting color to transparent – the grid will not highlight cells.
2. In the callback Grid.RowUpdated you will get a notification from your business object and there you can highlight needed cells.
Below is an example:
grid1.Highlighting.Color = Color.Transparent;
grid1.RowUpdated += delegate(object o, GridRowUpdateEventArgs e)
{
if (e.DataField.Id == "Name" || e.DataField.Id == "Time")
{
e.Row[e.DataField.Id].Highlight(TimeSpan.FromSeconds(1), Color.Green);
}
};
Best regards,
The Dapfor Team0
Please sign in to leave a comment.
Comments
1 comment