is there anybody who can give me a hint how i can draw a progess bar inside the grid?

The progress bar should have a green range for the done part and a red range for the undone part. So there is a 100 percent bar which contains these two parts. 100% done is a full green bar at the end.

Is that possible?

Drawing the red circle like in the example is working without Problems.

thank you in advance!
The Folder Size Manager and Custom Draw Cells samples from the main iGrid demo demonstrate how to draw customized progress bars in iGrid cells.
Trevor Finch
The code samples really are excellent

Set the color with e.g. CreateSolidBrush(vbRed) or RGB() instead of a system color

The 'CustomDraw' event seems to raised asynchronously, whenever the cell needs redrawing, not as the grid cells are loaded.

So if the grid is filled from a recordset, and the values used by the progress bar come from fields in the recordset, then those fields need to be in the grid.

Alternatively you need to re-position the current record in the CustomDraw event

CustomDraw also seems to be raised whenever any cell in that row is changed (???), which saved a lot of code
All operations in iGrid, including its events, are synchronous.

The CustomDrawCell event is raised only when a cell must be redrawn. For instance, when it becomes visible in the viewport or when its value has been changed. If you need to force iGrid to redraw a cell, use the DrawCell method or even Refresh.

And if I understand the logic of your app properly, you do not want to store progress bar values in iGrid cells and want to retrieve them dynamically from the underlying recordset in your CustomDrawCell event handler. This approach will slow down the performance of your grid a lot as the CustomDrawCell event can be raised many times for the same cells while the user sees them in the viewport (for instance, during scrolling). In fact, you will need to reposition the current record many times a second for those cells. I recommend that you copy all required values into iGrid cells and access them from this "native store".
Trevor Finch
Thankyou Igor

Are you saying that the CustomDraw event is raised when *any* cell in the grid is changed, or just cells in it's row ?

This application gets external data (via RS232), but we know which record in the recordset has been updated

So we just re-load that row in the grid, and that automatically fires CustomDraw

And thankyou for your suggestion about re-positioning the record.

The end-users can configure the grid, so it is possible the values feeding the progress bar might not be in the grid

So we will have to add them as hidden columns

Even with recordset re-positioning, the grid refresh is so fast it was only with lots of debug.print's could we work out what was going on.
The CustomDrawCell event for a cell is raised when this cell must be updated on the screen. This happens in many situations - for instance, when you change the cell's value from code.

However, the iGrid drawing routine is highly optimized, and iGrid redraws the whole row when one of its cells is changed or needs to be redrawn. Sure, only the cells in the columns visible in the viewport are updated. In fact, this part of a row is drawn in an internal buffer and then it is copied to the screen to avoid flickering.
Hi, I'm using Access 2010.

I can't find an example what I can use? Yes there is an example but this only shows the result but not how to do?

Got it! :-)

I extracted the relevant parts for my Needs from the modules directory etc.


The Folder Size Manager and Custom Draw Cells samples from the main iGrid demo demonstrate how to draw customized progress bars in iGrid cells.

I downloaded the executable, but I don't know how to see the code to get an example of how to place a progress bar inside a cell.
I haven't programmed in vb6 for many years and now I'm getting back to it.

Could you provide an example code to have a progress bar in a cell?
I need to update an old system

Thank you very much
If you install the iGrid demo, it also deploys the full VB6 source code of the demo app. You need FolderSizeManager.frm. The core event handler is the following:

Private Sub iGrid1_CustomDrawCell( _
      ByVal lRow As Long, ByVal lCol As Long, _
      ByVal hdc As Long, ByVal lLeft As Long, ByVal lTop As Long, _
      ByVal lRight As Long, ByVal lBottom As Long, ByVal bSelected As Boolean)

   Dim lValueWidth As Long
   Dim myRect As RECT
   Dim myPercentValue As Long
   myPercentValue = iGrid1.CellValue(lRow, lCol) ' It is a Long value from 0 to 100
   lValueWidth = ((lRight - lLeft - 4) * myPercentValue) / 100
   If lValueWidth < 0 Then Exit Sub
   myRect.Left = lLeft + 1
   myRect.Top = lTop + 1
   myRect.Right = lRight - 1
   myRect.Bottom = lBottom - 1
   FillRect hdc, myRect, m_hBrushBarBorder
   myRect.Left = myRect.Left + 1
   myRect.Top = myRect.Top + 1
   myRect.Right = myRect.Right - 1
   myRect.Bottom = myRect.Bottom - 1
   FillRect hdc, myRect, m_hBrushBarFill
   myRect.Right = myRect.Left + lValueWidth
   FillRect hdc, myRect, m_hBrushBarValue
   myRect.Right = lRight - 2
   SetTextColor hdc, vbBlack
   DrawText hdc, myPercentValue & "%", -1, myRect, DT_CENTER
End Sub
I didn't even remember that it was possible to install the demo, I thought only the executable worked.
Thank you very much, I will follow the steps you gave me.