抖动的时候有个声音,声音资源的编译方法参考 [delphi之声音资源(*.res)的编译方法]
[code=delphi]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan, mmSystem; //mmSystem用于播放声音
type
TForm1 = class(TForm)
Button1: TButton;
XPManifest1: TXPManifest;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$R SOUND.RES} //编译好的声音资源,就是抖动的时候的那个声音
procedure TForm1.Button1Click(Sender: TObject);
var I: integer;
begin
PlaySound('sound', 0, SND_RESOURCE or SND_ASYNC);
for I := 0 to 4 do begin
Self.Refresh;//窗体刷新
Self.Top := Self.Top - 4; Sleep(50);
Self.Left := Self.Left - 4; Sleep(50);
Self.Top := Self.Top + 4; Sleep(50);
Self.Left := Self.Left + 4; Sleep(50);
end;
end;
end.[/code]
转载请注明:鸟儿博客 » delphi之模拟QQ窗口抖动