Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Shaking a form Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
21-Jan-03
Category
VCL-Forms
Language
Delphi All Versions
Views
39
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler

Shaking a Form

Answer:

Solve 1:

Just put a button in your form and insert these commands in the OnClick Event !
1   
2   procedure TForm1.Button1Click(Sender: TObject);
3   var
4     N: Integer; //Counter
5     TL, TT: Integer; //Backup for LEFT and TOP of teh FORM
6   begin
7     TL := Left; //Backups Left of the Form
8     TT := Top; //Backups Top  of the Form
9     //*********************************************************************
10    for N := 1 to 40 do
11    begin //Counter Time
12      Left := (TL - 10) + (Random(20)); {Shake Range in Horizontal Driection}
13      Top := (TT - 10) + (Random(20)); {Shake Range in Vertical  Driection}
14    end;
15    //*********************************************************************
16    Left := TL; //Restores Left of the Form
17    Top := TT; //Restores Top  of the Form
18  end;
19  
20  
21  Solve 2:
22  
23  var
24    iipt: Integer;
25  
26  procedure Tform1.FormCreate;
27  begin
28    iipt := Form1.Left;
29  end;
30  
31  procedure TForm1.Button2Click(Sender: TObject);
32  var
33    so: Integer;
34  begin
35    so := 0;
36    repeat
37      if Form1.Left = iipt - 10 then
38      begin
39        so := so + 1;
40        repeat
41          Form1.Left := Form1.Left + 1;
42        until Form1.Left = iipt
43      end
44      else
45        repeat
46          Form1.Left := Form1.Left - 1;
47        until Form1.Left = iipt - 10;
48    until so = 2;
49  end;
50  
51  
52  Solve 3:
53  
54  for i := 2 to 7 do
55  begin
56    for j := 0 to 10 do
57    begin
58      if int(int((i - 1) / 2) / 2) * 2 = int((i - 1) / 2) then
59        frmMain.Left := frmMain.Left + 1
60      else
61        frmMain.Left := frmMain.Left - 1;
62    end;
63  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC