不会吧?我做过这样的程序,没有问题啊。
我是动态创建的一个TProgressBar,将它的Parent设为StatusBar。这一段不是在Form的OnCreate过程中,是在每次需要使用ProgressBar之前。if not(assigned(ProgressBar1)) then
begin
ProgressBar1 := TProgressBar.Creat(Form1);
ProgressBar1.Parent := StatusBar1;
ProgressBar1.SetBound(PanelRect.Left, PanelRect.Top, PanelRect.Right - PanelRect.Left, PanelRect.Bottom - PanelRect.Top);
ProgressBar1.Visable := true;
StatusBar1.Repaint;
end;
ProgressBar1.Position := 0;
ProgressBar1.Min := 0;PanelRect是一个TRect型的全局变量,在StatusBar的OnDrawPanel事件中赋值。procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
begin
if Panel.Index = 1 then PanelRect := Rect;
end;
我是动态创建的一个TProgressBar,将它的Parent设为StatusBar。这一段不是在Form的OnCreate过程中,是在每次需要使用ProgressBar之前。if not(assigned(ProgressBar1)) then
begin
ProgressBar1 := TProgressBar.Creat(Form1);
ProgressBar1.Parent := StatusBar1;
ProgressBar1.SetBound(PanelRect.Left, PanelRect.Top, PanelRect.Right - PanelRect.Left, PanelRect.Bottom - PanelRect.Top);
ProgressBar1.Visable := true;
StatusBar1.Repaint;
end;
ProgressBar1.Position := 0;
ProgressBar1.Min := 0;PanelRect是一个TRect型的全局变量,在StatusBar的OnDrawPanel事件中赋值。procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
begin
if Panel.Index = 1 then PanelRect := Rect;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货