December 1, 2003 06:38 PM
That sample fires a timer every 10 msecs. When you split things in 4 panes, you have 4 such timers firing every 10 msecs on the same UI thread. This is bogging things down.
Here is a sample that uses multiple threads to avoid bogging down the UI thread.
December 5, 2003 12:47 PM
Even though it gets booged down should it be throwing unhandled exceptions? What exactly is causing it to throw exceptions? If it is getting bogged down then shouldnt it just go slower?
December 5, 2003 01:39 PM
The problem is that the timer tick is fired before the previous timer tick is completed. This means that the Application.DoEvents(); at the bottom of the timer tick event is really never hit, and window messages are just being queued and not processed, with the Timer Tick events just getting queued up.
So, if you move the Application.DoEvents(); from the bottom to the top of the timer tick event, things work more smoothly, but still bog down.
December 5, 2003 03:02 PM
The correct implementation would actually be to have only one timer fired that updates the grids progress bar values through the model.
It''s just that in the ProgressBarSample sample we didn''t consider the case that all four panes are open and then 4 timers compete with each other.
December 6, 2003 02:00 AM
Setting a flag to avoid multiple calls into the tick handler seems to handles things. You can scroll the panes slightly to see the faster moving progressbars, and size the form without locking up.
private bool inTimer = false;
private void timer_Tick(object sender, EventArgs e)
this.inTimer = true;
for (int rowIndex = 3; rowIndex < 14; rowIndex += 2)
GridStyleInfo style = gridControl1[rowIndex, 2];
GridProgressBarInfo progressBarEx= style.ProgressBar;
int pvalue = (progressBarEx.ProgressValue + rowIndex)%100;
progressBarEx.ProgressValue = pvalue;
this.inTimer = false;
December 6, 2003 09:40 AM
I made the changes to the sample and it still throws exceptions occasionally. It only seem to throw them now when I animate the progress bars, then create a split pane then close the split pane. When I close the split pane it throws the following exception. Is this easily fixed?
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: rowIndex
at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly)
at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType)
at Syncfusion.Windows.Forms.Grid.GridModel.ChangeCells(GridRangeInfo range, GridStyleInfo cellsInfo, StyleModifyType modifyType)
at Syncfusion.Windows.Forms.Grid.GridModel.Syncfusion.Windows.Forms.Grid.IGridVolatileDataContainer.ChangeCell(Int32 rowIndex, Int32 colIndex, GridStyleInfo style)
at Syncfusion.Windows.Forms.Grid.GridVolatileData.set_Item(Int32 rowIndex, Int32 colIndex, GridStyleInfo value)
at Syncfusion.Windows.Forms.Grid.GridStyleInfoIdentity.OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip)
at Syncfusion.Styles.StyleInfoBase.OnStyleChanged(StyleInfoProperty sip)
at Syncfusion.Windows.Forms.Grid.GridStyleInfo.OnStyleChanged(StyleInfoProperty sip)
at Syncfusion.Styles.StyleInfoBase.OnSubObjectChanged(IStyleInfoSubObject subObject)
at Syncfusion.Styles.StyleInfoSubObjectBase.OnStyleChanged(StyleInfoProperty sip)
at Syncfusion.Styles.StyleInfoBase.SetValue(StyleInfoProperty sip, Object value)
at Syncfusion.Windows.Forms.Grid.GridProgressBarInfo.set_ProgressValue(Int32 value)
at GridSample.MainForm.timer_Tick(Object sender, EventArgs e) in c:\program files\syncfusion\essential suite evaluation\grid\samples\celltypes\progressbarcells\cs\mainform.cs:line 402
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)
December 6, 2003 02:59 PM
You need to add splitter_PaneCreated and splitter_paneClosing event to subscribe to the CurrentCellChanged event. If you don''t do this, then when you close a pane, the event is lost. You also have to change the CurrentCellChanged event handler to used the sender to get at the grid. Here is a new mainform.cs file with these changes.