製作一張寬 300、高 20 的左右漸變圖片 (左邊顏色 = 右邊顏色,如橙-黃-橙),放入兩個 TImage 並排,以 TTimer 定時移動圖片位置形成流動效果。
Image1->Top = 0; Image1->Left = 0;
Image1->Height = Panel1->Height; Image1->Width = Panel1->Width;
Image1->Stretch = true;
Image2->Top = 0; Image2->Left = -Panel1->Width; // 緊接在 Image1 左側
Image2->Height = Panel1->Height; Image2->Width = Panel1->Width;
Image2->Stretch = true;
Image1->Left++;
if (Image1->Left == Image1->Width) Image1->Left = -Image1->Width;
Image2->Left++;
if (Image2->Left == Image1->Width) Image2->Left = -Image1->Width;
TPanel (BorderStyle=bsSingle) 作為進度條容器。TImage 置於 Panel 內,Picture 指定同一張漸變圖。TTimer Interval=10 (約 100 FPS)。兩張圖片無縫循環左移,產生平滑流動的漸變進度條動畫,資源佔用極低。