Autor Beitrag
cubeolus
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Mi 01.11.06 12:45 
hi leute ich sitze hier in Info und komm ned mehr weiter...

und zwar will ich einen Timer bei einem Atommodell einbauen.


Also im prinzip soll es so ablaufen. Ich hab einzelne Elektronen auf meinem Atommmodell und diese sollen sich dann auf der Ellipse bewegen. Unser Lehrer meinte das ginge mit nem Timer... wie kann ich so einen einfügen??

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
procedure TForm1.BtAtommodellClick(Sender: TObject);
var s,u, i,a,b,c:real;
    x,f,y,x0,y0 : longint;
      bitmap:tbitmap;

begin

a:=100;
b:=200;
s:=0.00001;
c:=1;

begin
  bitmap:=tbitmap.Create;
  bitmap.assign(Form1.ImageBall.Picture);
repeat
u:=c*pi/4;
i:=0;
randomize;
f:=random(maxint);
Repeat
  x:=trunc(a*cos(i));
  y:=trunc(b*sin(i));
  x0:=trunc(x*cos(u)-y*sin(u));
  y0:=trunc(x*sin(u)+y*cos(u));
  canvas.pixels[x0+300,y0 + 300]:=clblack;
     if (round(i*1000))/1000 = 1.571
   then  Form1.Canvas.Draw(x0+295,y0+295,bitmap);
  i:=i+s;

until i>6.28;
c:=c+1;
//u:=u+pi/8;
   // Form1.Canvas.Draw(x0+300,y0+300,bitmap);
until u>6.28;




end;
end;
end.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 02.11.06 22:20 
Moin und :welcome: im Forum!

user profile iconcubeolus hat folgendes geschrieben:
das ginge mit nem Timer... wie kann ich so einen einfügen??

In der Komponentenpalette "System" gibt es den TTimer, einfach anklicken und auf das Formular legen, dann F1 drücken und in der Delphi-Online-Hilfe lesen, wie man die Komponente benutzt (ist mit Beispiel).

Ansonsten findest du hier im Forum sicherlich haufenweise Code zum Thema Timer, einfach mal die Suchfunktion benutzen: Suche in: Delphi-Forum, Delphi-Library TTIMER

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.