窗体抖动的实现

现在的QQ,MSN都拥有窗体抖动的功能,其实要实现它并不困难
窗体之所以会表现为“抖动”,其实质就是窗体的坐标在变化。与是就有了下面这些代码:

procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
t: Integer;
l: Integer;
seed: Integer;
begin
t:=Self.Top;
l:=self.Left;
seed := 0;
for i:=0 to 15 do
begin
    Application.ProcessMessages;
    case seed of
    0: begin
         self.Top := t + 10;
         Self.Left := l + 10;
         seed := 1;
       end;
    1: begin
         self.Top := t - 10;
         Self.Left := l - 10;
         seed := 0;
       end;
    end;
    SleepEx(50,True);
end;
self.Top := t;
Self.Left := l;
end;

=====================================================
var
FWinfo: TFlashWInfo;
begin
FWinfo.cbSize := 20;
FWinfo.hwnd := Application.Handle;
FWinfo.dwflags := FLASHW_ALL;
FWinfo.ucount := 10;
FWinfo.dwtimeout := 0;
FlashWindowEx(FWinfo);
end;

以上实现即可完成窗体在任务栏的闪烁

你可能感兴趣的:(delphi)