Color in ProgressBar?

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Color in ProgressBar?

Postby Sailor » Wed Jan 12, 2005 2:29 pm

The default color is obviosly blue for the ProgressBar...

Does anyone know how to change this?
Sailor
 

Postby Lars » Wed Jan 12, 2005 5:33 pm

You can use:

ProgressBar1->Perform( PBM_SETBARCOLOR, 0 , TColor );

Example:
Code: Select all
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    static const int noOfColors = 3;
    static int changeColor = 0;

    ProgressBar1->Position = ProgressBar1->Max;

    switch( changeColor )
    {
        case 0:
            ProgressBar1->Perform( PBM_SETBARCOLOR, 0 , clRed );
            break;
        case 1:
            ProgressBar1->Perform( PBM_SETBARCOLOR, 0 , clYellow );
            break;
        case 2:
            ProgressBar1->Perform( PBM_SETBARCOLOR, 0 , clGreen );
            break;
    }

    changeColor = ( changeColor + 1 ) % noOfColors;
}
Lars
 

RE: Color ProgressBar

Postby Sailor » Fri Jan 14, 2005 12:44 pm

Thanks Lars,
It works perfectly!
Sailor
 


Return to Technical

Who is online

Users browsing this forum: No registered users and 22 guests