We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Style of a cell flickering

Thread ID:

Created:

Updated:

Platform:

Replies:

69221 Oct 18,2007 05:15 PM Oct 22,2007 11:23 AM Windows Forms 4
loading
Tags: GridControl
Alexei Ostrov
Asked On October 18, 2007 05:15 PM

I am using GridControl.
I am setting 3 levels of styles.
1. The background style for the whole Grid range. This is done on Grid setup.
2. As I have a custom FilterBar in the first row I am setting a specific style for it as well. This is done on Grid setup.
3. The third style is the style of the specific cell that was just modified (or previously) by the user. This is done in QueryCellInfo like so:
CustomRowBarEventArgs args =
new CustomRowBarEventArgs(e.RowIndex, GetFieldIdFromColIndex(e.ColIndex),
column.CacheIndex, e.Style);
c.OnGridCustomRowBar(args);
e.Handled = true;

In the same handler I see and ignore requests for the style of the whole FilterBar row, as it seems redundant.

The problem that I see is that I see flicker between the RowStyle and CellStyle on each grid update (every half a second) in the cell of the FilterBar that already has a value and is being edited. Also, the cursor jumps between positions in the cell string.
It looks like I am missing something trivial like
BeginEditStyle
setStyle
EndEditStyle
type of thing...
Could you please point me into the right direction?

Administrator [Syncfusion]
Replied On October 19, 2007 08:01 AM

QueryCellInfo is raised several times for each cell.

When e.RowIndex and e.ColIndex are both -1, then the request is for the style associated with grid.TableStyle.

When e.RowIndex > 0 and e.ColIndex == 0, then the request is for the row style, grid.RowStyles[e.RowIndex].

When e.RowIndex == 0 and e.ColIndex > 0, the request is for grid.ColStyles[e.ColIndex].

It is only when both e.RowIndex and e.ColIndex are nonnegative that the grid is requesting the particular cell style. So, you may want only want to raise the event when the grid is requesting a cell style to see if that will avoid the problem you are seeing.

Alexei Ostrov
Replied On October 19, 2007 10:50 AM

Clay,
thank you very much for your answer.
I should have been clearer in what I am doing. As I said, I am ignoring the requests for row and column styles. In fact, I am ignoring anything other than my custom filter bar cells indexes.
After a bit more experimenting, I see that I see flicker even when I only set different style for my row like this:
...snip..
if (e.ColIndex < 0) // this is asking for dynamic style of the row whose index is passed
{
if (e.RowIndex == ((CustomRowBar)FilterBar).CustomRowIndex)
{
forDebugOnlySetFilterStyle(e.Style);
return;
}
}
...snip..

...snip..
private void forDebugOnlySetFilterStyle(GridStyleInfo style)
{
style.Font.Bold = false;
style.BackColor = Color.LightBlue;
style.TextColor = Color.Black;
style.CellType = GridCellTypeName.TextBox;
style.ReadOnly = false;
}
...snip..

As a side note, my grid is about 3500 rows by 10 columns (but this should not be the limit).
My group has inherited this grid and it is in pretty bad shape. I am pretty new to GridControl but intend to fix it up.

Thank you very much for your help.

Administrator [Syncfusion]
Replied On October 19, 2007 12:12 PM

You can try sandwiching this code that changes the style between

style.BeginInit();
//change code...
style.EndInit();

to see if this avoids the flicker.

Alexei Ostrov
Replied On October 22, 2007 11:23 AM

This was caused mostly by our own code. I achieved by locking CurrentCell.

Thank you for your help

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;