Delphi'de hazırladığınız programa MSN'de olduğu gibi bazı koşullarda kullanıcıyı uyarmak ya da olaya mizahi bir özellik katmak için titreşim ekleyebilirsiniz.
Yapmanız gereken şey bu kodları kullanmak:
Yapmanız gereken şey bu kodları kullanmak:
Kod:
procedure NudgeWindow(theWinControl: TWinControl; non: integer; wSound: Boolean);
var
i, j, A, AK2: integer;
orgLeft, orgTop: integer;
P: array[1..9] of TPoint;
begin
orgLeft := theWinControl.Left;
orgTop := theWinControl.Top;
A := 5; AK2 := Round(A * sqrt(2));
// sekizgen koordinatlari
P[1] := Point(0, A);
P[2] := Point(-AK2, -AK2);
P[3] := Point(A, 0);
P[4] := Point(-AK2, AK2);
P[5] := Point(0, -A);
P[6] := Point(AK2, AK2);
P[7] := Point(-A, 0);
P[8] := Point(AK2, -AK2);
P[9] := Point(0, A);
// uses kismina MMSystem
if wSound then
PlaySound(PChar(SES), 0, SND_RESOURCE or SND_ASYNC);
for j:=1 to abs(non) do
begin
theWinControl.Left := orgLeft;
theWinControl.Top := orgTop;
for i:=1 to 9 do
begin
theWinControl.Left := theWinControl.Left + P.X;
theWinControl.Top := theWinControl.Top + P.Y;
theWinControl.Update;
Sleep(25); // ???
end;
end;
theWinControl.Left := orgLeft;
theWinControl.Top := orgTop;
end;