delphi编程修改ProgressBar的颜色
关键代码如下:

uses

CommCtrl;

procedure TForm1.Button1Click(Sender: TObject);

begin

// Set the Background color to teal

Progressbar1.Brush.Color := clTeal;

// Set bar color to yellow

SendMessage(ProgressBar1.Handle, PBM_SETBARCOLOR, 0, clYellow);

end;

WinXP风格进度条

const

{$EXTERNALSYM PBS_MARQUEE}

PBS_MARQUEE = 08;

 

procedure TForm1.FormCreate(Sender: TObject);

begin

SetWindowLong(ProgressBar1.Handle, GWL_STYLE,

GetWindowLong(ProgressBar1.Handle, GWL_STYLE) or PBS_MARQUEE);

end;

//------------------------------------------------------------------------------

procedure TForm1.Button1Click(Sender: TObject);

var

i: Integer;

begin

for i := 0 to 30 do

begin

Sleep(100);

ProgressBar1.StepIt;

Application.ProcessMessages;

end;

end;

posted on 2010-09-28 11:18  sunjun0427  阅读(2276)  评论(0编辑  收藏  举报