In the WinGrid sample explorer for Infragistics 7.1 version, a sample named "Flood Fill" (located in "Extensibility Samples")demonstrate how progress bar can be included in cells.
I have studied the source code and seen that this functionality in not a built-in one, but uses the DrawElement method to paint a rectangle in each cell. I have also remarked that for long bounded tables (ie with a lot of rows), rectangles take some time to draw (we can see each rectangle to be drawn).
I would like to know if this functionality is now included in the component or if it will be in the futur. If not, are there some possible code optimisations to do to increase draw performance?
Thanks in advance.
Rico
Hi,
After implementing the solution, I met a problem - maybe a bug - when adding a progressbar control in a calculated column (column with a Formula defined and an UltraCalcManager on the form).
The problem is that the displayed progressbar values are 0 for all rows in my ultraGrid, as if the progressbar control wasn't able to get the calculated value. When I remove the Progressbar control from the EditorControl, all values are displayed. After debugging, I noticed that the Progressbar.Value property throws an exception (UltraGrid1.Rows(0).Cells(1).EditorResolved.Value {"Object reference not set to an instance of an object."} Object).
An other problem is a huge performance penality when setting the UltraProgressBar to the column's editor control property, even for small datasource (2 columns & 5 rows) : all actions on the form freezes it for several seconds.
Thanks Mike,
You're right, the method you give here is much more simple than drawing a rectangle for each cell in the DrawElement event handler ; and it does not hurt display performances, so it is the solution I adopted.
For others that have the same needs, here is a sample code on how to achieve my goal on the 'colName' column:
Dim col As Infragistics.Win.UltraWinGrid.UltraGridColumn
col = Me.UltraGrid1.DisplayLayout.Bands(0).Columns(colName)
' Set column min & max values
Dim dv As New Data.DataView(Me.UltraGrid1TableDatasource) dv.Sort = colName + " DESC"
col.MinValue = dv(dv.Count - 1)(colName) col.MaxValue = dv(0)(colName) Dim upb As New Infragistics.Win.UltraWinProgressBar.UltraProgressBar upb.Visible = False upb.UseFlatMode = Infragistics.Win.DefaultableBoolean.True
' Set SupportThemes to false to allow Continuous progress bar Me.UltraGrid1.UseOsThemes = Infragistics.Win.DefaultableBoolean.False
upb.Style = Infragistics.Win.UltraWinProgressBar.ProgressBarStyle.Continuous Me.Controls.Add(upb) col.EditorControl = upb col.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center
Thanks again for your answer.
Hi Rico,
That sample is pretty old and there is a new, better way.
You can now use the UltraProgressBar control for this. Just put one on the form with the grid and assign the column's EditorControl property to the ProgressBar. You will probably want to set the MinValue and MaxValue on the grid column, as well, to give the progress bar the correct range of values.