文件名称:类似QQ,MSN的窗口震动效果
文件大小:6KB
文件格式:RAR
更新时间:2014-04-15 15:27:19
类似QQ,MSN的窗口震动效果
类似QQ,MSN的窗口震动效果,里面有源代码。 unit ShakeWindow; interface uses Classes, Windows, Forms; const Max_PTCount = 40; type TShakeThread = class(TThread) private FForm: TCustomForm; FXStrength: Integer; FYStrength: Integer; FPTArray: array [0..Max_PTCount - 1] of TPoint; procedure InitPTArray; procedure SetXStrength(const Value: Integer); procedure SetYStrength(const Value: Integer); protected procedure Execute; override; public property Form: TCustomForm read FForm write FForm; property XStrength: Integer read FXStrength write SetXStrength; property YStrength: Integer read FYStrength write SetYStrength; end; procedure Shake(valForm: TCustomForm; valXStrength: Integer = 4; valYStrength: Integer = 4); implementation uses Math; procedure Shake(valForm: TCustomForm; valXStrength: Integer = 4; valYStrength: Integer = 4); begin with TShakeThread.Create(True) do begin Form := valForm; XStrength := valXStrength; YStrength := valYStrength; FreeOnTerminate := True; Resume; end; end; procedure TShakeThread.Execute; var I: Integer; P: TPoint; begin InitPTArray; P := Point(FForm.Left, FForm.Top); for I := Max_PTCount - 1 downto 0 do begin SetWindowPos(FForm.Handle, 0, P.X + FPTArray[I].X, P.Y + FPTArray[I].Y, 0, 0, SWP_NOSIZE or SWP_NOREPOSITION); Sleep(20); end; end; procedure TShakeThread.InitPTArray; var I: Integer; function Sign(): Integer; begin Result := IfThen(RandomRange(0, 36635) mod 2 = 0, -1, 1); end; begin Randomize; for I := Max_PTCount - 1 downto 0 do begin FPTArray[i].X := Sign()*RandomRange(0, 36635) mod FXStrength*i div 10; FPTArray[i].Y := Sign()*RandomRange(0, 36635) mod FYStrength*i div 10; end; end; procedure TShakeThread.SetXStrength(const Value: Integer); begin if Value < 4 then FXStrength := 4 else if Value > 20 then FXStrength := 20 else FXStrength := Value; end; procedure TShakeThread.SetYStrength(const Value: Integer); begin if Value < 4 then FYStrength := 4 else if Value > 20 then FYStrength := 20 else FYStrength := Value; end; end.
【文件预览】:
ShakeWindow
----ShakeWindow.pas(2KB)
----Project1.dof(11KB)
----del.bat(248B)
----Unit1.dfm(496B)
----Project1.cfg(434B)
----Project1.dpr(244B)
----Unit1.pas(491B)
----Project1.res(876B)
----Delphi盒子.url(259B)
----2ccc.com.nfo(753B)