daneb
asked on
I wona side form acros the screen
I wona side form acros the screen after i click on
button and stop in the center of screen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
first add Math to your uses clause -
private
{ Private declarations }
EndPos, StartPos, Mover: TPoint;
Radian1: Extended;
PixelMov: Integer;
procedure TForm1.but_MoveFormClick(S
begin
{this is the button click}
StartPos.x := Left;
StartPos.y := Top;
EndPos.x := (Screen.Width div 2)- (Width div 2);
EndPos.y := (Screen.Height div 2) - (Height div 2);
Mover.x := 0;
Mover.y := Round(Sqrt(SumOfSquares([a
Radian1 := DegToRad(180 * (1 + ArcTan2(EndPos.y-StartPos.
PixelMov := 8;
Timer3.Interval := 55;
{the PixelMov and the length of the timer Interval will determin
the speed of movement}
Timer3.Enabled := True;
end;
procedure TForm1.Timer3Timer(Sender:
begin
SetBounds(Round(StartPos.x
Round(StartPos.y-Sin(Radia
Inc(Mover.x);
if (Mover.x > Mover.y) or (Mover.x > 3000) then
begin
Timer3.Enabled := False;
SetBounds(EndPos.x, EndPos.y, Width, Height)
end;
end;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ask question if you need more information