Baca Juga: Cara Membuat Form Menu Menarik di delphi 7
Ok dech sobat bagi yang mau mencoba program ini, silahkan klik tombol download di bawah ini.
Berikut coding lengkap nya.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, TeEngine, Series, TeeProcs, Chart, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Chart1: TChart;
Series1: TLineSeries;
TrackBar1: TTrackBar;
TrackBar2: TTrackBar;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Timer1: TTimer;
Button1: TButton;
Chart2: TChart;
Series2: TFastLineSeries;
Edit6: TEdit;
Timer2: TTimer;
Button2: TButton;
Button3: TButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Timer3: TTimer;
Label10: TLabel;
Label11: TLabel;
Timer4: TTimer;
Panel2: TPanel;
Label12: TLabel;
Timer5: TTimer;
procedure TrackBar1Change(Sender: TObject);
procedure TrackBar2Change(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Panel1Click(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure Timer5Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit3Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ft : Integer;
x : Integer;
y: Double;
xx : integer;
implementation
{$R *.dfm}
procedure TForm1.TrackBar1Change(Sender: TObject);
var x : integer;
begin
x:=TrackBar1.Position;
Edit1.Text:=IntToStr(x);
Series1.Clear;
end;
procedure TForm1.TrackBar2Change(Sender: TObject);
var xx:integer;
begin
xx:=TrackBar2.Position;
Edit2.Text:=IntToStr(xx);
Series1.Clear;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
ft := ft + StrToInt(edit2.Text);
y:= StrToFloat(Edit1.Text)* sin((2 * 3.14/100) * ft);
Series1.AddXY(ft,y);
edit3.Text:= FloatToStr(y);
if ft=5000 then
begin
ft:=1;
Series1.Clear;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if Button1.Caption = 'Stop' then
begin
Timer1.Enabled:= false;
Button1.Caption:= 'Start';
end
else
begin
Timer1.Enabled:= True;
Button1.Caption := 'Stop';
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
ft := ft + StrToInt(edit2.Text);
y:= StrToFloat(Edit1.Text)* cos((2 * 3.14/100) * ft);
Series2.AddXY(ft,y);
edit6.Text:= FloatToStr(y);
if ft=5000 then
begin
ft:=1;
Series2.Clear;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if Button2.Caption = 'Stop' then
begin
Timer2.Enabled:= false;
Button2.Caption:= 'Start';
end
else
begin
Timer2.Enabled:= True;
Button2.Caption := 'Stop';
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if (Application.MessageBox('Anda Yakin Akan Keluar','Informasi',MB_YESNO)=IDYES) then
Close;
end;
procedure TForm1.Panel1Click(Sender: TObject);
begin
Label8.Caption:=timetostr(time);
Label9.Caption:=datetostr(now);
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
Label8.Caption:=timetostr(time);
Label9.Caption:=datetostr(now);
end;
procedure TForm1.Timer4Timer(Sender: TObject);
begin
if Label10.Visible then
Label10.Visible:=False
else Label10.Visible:=True;
if Label11.Visible then
Label11.Visible:=False
else Label11.Visible:=True;
end;
procedure TForm1.Timer5Timer(Sender: TObject);
begin
if Label12.Left = -245 then
Label12.Left := 280;
Label12.Left := Label12.Left-1;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
AnimateWindow(Self.Handle,999, AW_HOR_POSITIVE or AW_ACTIVATE);
end;
end;
Semoga Bermanfaat
Share This :
0 komentar