1. Computing

How to Change the Colors of the TProgressBar

From , former About.com Guide

How to Change the Colors of the TProgressBar

The TProgressBar Delphi component displays a simple progress bar. Progress bars provide users with visual feedback about the progress of a procedure within an application.

By design, the colors of a progress bar are determined by Windows. Here's how to change the background color and the bar color of a TProgressBar component, at run-time (download sample application):

 uses CommCtrl, ...
 ...
 // Set Background color
 ProgressBar1.Brush.Color := clRed;
 // Set Bar color
 SendMessage(ProgressBar1.Handle, PBM_SETBARCOLOR, 0, clBlue) ;
 

Delphi tips navigator:
» How to Clone a Delphi Form
« How to Right Align a Menu Item

©2013 About.com. All rights reserved.