资 源 简 介
使用Delphi 制作无闪烁的动画效果,如何实现不闪烁的动画呢?这个例子或许能找到一些答案:部分代码如下:
var
x,i: Integer;
dir,run: Boolean;
begin
b := TBitMap.Create;
b.Width := AnimWindow.Width;
b.Height := 32;
b.Canvas.Pen.Color := clBtnFace;
b.Canvas.Brush.Color := clBtnFace;
b.Canvas.Rectangle(0,0,AnimWindow.Width,32);
run := True;
dir := False;
x := 0;
while run do
for i := 0 to AnimWindow.ImageList1.Count-1 do
begin
b.Canvas.Rectangle(0,0,AnimWindow.Width,32);
AnimWindow.ImageList1.Draw(b.Canvas,x,0,i);
Synchronize(DrawAnimPic);
Sleep(AnimWindow.SpinEdit1.Value);
if (x = 0) or (x = 300) then dir := not dir;
if dir then Inc(x) else Dec(x);
end;
b.Free;
end;