class CGXProgressCtrl: public CGXControl
The CGXProgressCtrl class lets you display a progress bar in cells. It also lets you display text in the cell.
Style attributes which specify the appearance of the cell are:
-
Value with SetValue.
-
Caption bar color with SetColor.
-
Background color with SetInterior.
-
Caption bar 3d-effect (raised, inset, normal) with SetDraw3dFrame.
-
Borders with SetBorder.
-
Font with SetFont.
-
Read only with SetReadOnly.
-
Lower bound for value: user attribute GX_IDS_UA_PROGRESS_MIN.
-
Higher bound for value: user attribute GX_IDS_UA_PROGRESS_MAX.
-
Text to be displayed in cell (sprintf format for value): user attribute GX_IDS_UA_PROGRESS_CAPTIONMASK.
- default id for CGXProgressCtrl controls is GX_IDS_CTRL_PROGRESS.
Here is how you can apply the progress bar to cells:
SetStyleRange(CGXRange(4,3,10,5),
CGXStyle()
.SetControl(GX_IDS_CTRL_PROGRESS)
.SetValue(50L)
.SetUserAttribute(GX_IDS_UA_PROGRESS_MIN, _T("0"))
.SetUserAttribute(GX_IDS_UA_PROGRESS_MAX, _T("100"))
.SetUserAttribute(GX_IDS_UA_PROGRESS_CAPTIONMASK, _T("%ld %%")) // sprintf formatting for value
.SetTextColor(RGB(0, 0, 255)) // blue progress bar
.SetInterior(RGB(255, 255, 255)) // on white background
);
You can change the value for cells at run time by calling SetValueRange().
Note:
When you change the value for a progress control, the progress control will not let you store invalid values. When you try to set a value below the lower bound or above the upper bound, the value will be adjusted so that it fits the given range.
#include <gxall.h>
See Also
CGXGridCore::RegisterControl CGXStyle::SetControl CGXStyle