感谢zswangII的提点,但是我试了:uses CommCtrl;
procedure TForm1.Button1Click(Sender: TObject);
begin
ProgressBar1.Position := 30;
TForm(ProgressBar1).Color := clYellow;
ProgressBar1.Perform(PBM_SETBARCOLOR, 0, clRed);
end;PBM_SETBARCOLOR消息好像在delphi中没有定义,但是在c++builder中有。
该怎么办啊?
另外TProgressBar有个filecolor的属性好像也不能用
procedure TForm1.Button1Click(Sender: TObject);
begin
ProgressBar1.Position := 30;
TForm(ProgressBar1).Color := clYellow;
ProgressBar1.Perform(PBM_SETBARCOLOR, 0, clRed);
end;PBM_SETBARCOLOR消息好像在delphi中没有定义,但是在c++builder中有。
该怎么办啊?
另外TProgressBar有个filecolor的属性好像也不能用
implementation
uses CommCtrl;
{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
改变ProgressBar的颜色?change the color of a TProgressbar?usesCommCtrl;procedure TForm1.Button1Click(Sender: TObject);begin// Set the Background color to tealProgressbar1.Brush.Color := clTeal;// Set bar color to yellowSendMessage(ProgressBar1.Handle, PBM_SETBARCOLOR, 0, clYellow);end;WinXP风格进度条const{$EXTERNALSYM PBS_MARQUEE}PBS_MARQUEE = 08; procedure TForm1.FormCreate(Sender: TObject);beginSetWindowLong(ProgressBar1.Handle, GWL_STYLE,GetWindowLong(ProgressBar1.Handle, GWL_STYLE) or PBS_MARQUEE);end;//------------------------------------------------------------------------------procedure TForm1.Button1Click(Sender: TObject);vari: Integer;beginfor i := 0 to 30 dobeginSleep(100);ProgressBar1.StepIt;Application.ProcessMessages;end;end;
//不过,怎么会找不到?搜索包含“PBM_SETBARCOLOR”的pas文件不难吧!……
//搜索包含“PBM_SETBARCOLOR”的网页不难吧!……
const
{$EXTERNALSYM PBM_SETBARCOLOR}
PBM_SETBARCOLOR = WM_USER+9; // lParam = bar color