Home Forums WinForms controls Xceed Grid for WinForms Performance comparisons? Reply To: Performance comparisons?

User (Old forums)
Member
Post count: 23064

In our applications, the grid is usually bound to a DataTable that is filled in one time. Looking at the cellviewers of your grid, I see only 1 combobox (status), which probably doesn’t have a lot of elements.
It might also be because of the visual appearance of the grid: are you using stylesheets or images?
Another problem might be memory usage. If there’s a lot of data, the GridControl creates a lot of small objects. You said you’re binding to a DataSet. DataSets are also known for using a lot of memory.
Subclassing the GridControl doesn’t really let us enhance performance, just functionality. The higher performance is because we subclass the Xceed.Grid.DataRow and Xceed.Grid.DataCell. The methods of DataCell we override are: PaintBackground and PaintForeground.

Because we don’t use transparent background colors and background images, we can write a faster PaintBackground, like this:<code>protected override void PaintBackground(GridPaintEventArgs e)
{
using (Brush b = new SolidBrush(GetBackColorToPaint())
e.Graphics.FillRectangle(b, e.ClientRectangle);
}</code>
The standard PaintBackground probably checks if there is a background image, or if the background color is transparent.

And because cells in our grid never have a transparent background, the parent DataRow doesn’t have to paint its background every time. So you can override the PaintBackground method of the subclassed Xceed.Grid.DataRow, and just do nothing in it (don’t call base.PaintBackground!), like this:<code>protected override void PaintBackground(GridPaintEventArgs e)
{
// do nothing
}</code>

Imported from legacy forums. Posted by Tommy (had 365 views)