Print Page | Close Window

Progress bar in a cell

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=6748
Printed Date: 19 September 2024 at 8:57pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Progress bar in a cell
Posted By: Franco Prudente
Subject: Progress bar in a cell
Date Posted: 28 March 2007 at 8:29am
Hi, i would add a progress bar in a cell.
How can i do?
Thanks



Replies:
Posted By: fantama
Date Posted: 28 March 2007 at 9:09am
I would like to know too.  Please post some code actually doing this instead of saying use DrawItem event etc......  Would be nice if it did not take up entire cell and had a nice border around it.
Thanks


Posted By: pcmaker
Date Posted: 29 March 2007 at 3:00pm
QUE TAL GENTE.

LES PUEDO ESCRIBIR EN ESPAÑOL PARA ENTENDERNOS MEJOR.

YO SE LA MANERA PARA HACER LO QUE NECESITAN!


Posted By: fantama
Date Posted: 03 April 2007 at 9:31am
Gan we get an answer to this please?


Posted By: BagLady
Date Posted: 03 April 2007 at 9:33am
Any chance you can post a sample on how to do this, I have been following this thread for a while and am finally adding something as I see no response  This is very important to us.


Posted By: pcmaker
Date Posted: 03 April 2007 at 1:36pm
In VB6
1º  Put this in column declare:
wnd_rpc.SetCustomDraw xtpCustomBeforeDrawRow + xtpCustomDrawItem

2º In wnd_rpc_DrawItem event, this:
Private Sub wndAct_DrawItem(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal hdc As stdole.OLE_HANDLE, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long, DoDefault As Boolean)
If Column.Index = X Then
    drawProgressCell Item, hdc, left, top, right, bottom, Row.Record.Index
End If
End Sub
Where Column.Index = X is the column where you want use the progress bar.

3º The implement of drawProgressCell sub:
Sub drawProgressCell(Item As ReportRecordItem, hdc As stdole.OLE_HANDLE, _
    left As Long, top As Long, right As Long, bottom As Long, row_index As Long)
Dim rec_porct As Long
Select Case Item.Value
    Case Is < 10
        FillBrush = CreateSolidBrush(vbRed)
    Case Is = 100
        FillBrush = CreateSolidBrush(vbGreen)
    Case Else
        FillBrush = CreateSolidBrush(Me.BackColor)
End Select
DeleteObject SelectObject(hdc, FillBrush)
rec_porct = (Item.Value * (right - left)) / 100
RectangleX hdc, left, top + 1, left + rec_porct, bottom - 1
End Sub

4º In add_records sub, fill value of the progress cell with this:
Record.AddItem Format(va_porct, "###,##0.00")
        Record.Item(5).Format = "%s%%"
        Record.Item(5).ToolTip = va_porct & "%"
        Record.Item(5).ForeColor = vbBlack
This format the number, in order to keep the original value(double) in the value of cell.

I take a vacation until april 9.

I hope that this reply help you in your problems.

Bye, Juan Quintero - Venezuela.

PD: my englhis is bad, excuseme.


Posted By: Franco Prudente
Date Posted: 10 April 2007 at 3:46am
Thanks, i will try to implement this in C# code...



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net