Recent Posts

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Selasa, 12 November 2013

CARA BUAT SIMULASI LAMPU MERAH


simulasi lampu merah

#source code lengkap#
unit u_merah;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, math,
  Dialogs, ExtCtrls, StdCtrls, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore, dxSkinBlack,
  dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
  dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle,
  dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary,
  dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin,
  dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp,
  dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
  dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
  dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
  cxGroupBox, cxLabel;

type
  Tfo_merah = class(TForm)
    Timer1: TTimer;
    cxGroupBox1: TcxGroupBox;
    Shape1: TShape;
    Shape2: TShape;
    Shape3: TShape;
    cxGroupBox2: TcxGroupBox;
    Label2: TLabel;
    cxGroupBox3: TcxGroupBox;
    cxGroupBox5: TcxGroupBox;
    cxLabel1: TcxLabel;
    cxLabel2: TcxLabel;
    procedure Timer1Timer(Sender: TObject);
    procedure cxLabel1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fo_merah: Tfo_merah;
  detik, detik1:Integer;

const
  detHijau = 36;
  detKuning = 39;
  detMerah = 55;

implementation

uses u_nama;

{$R *.dfm}

procedure Tfo_merah.Timer1Timer(Sender: TObject);
begin
detik:=detik+1;
  if ((detik>=0)and (detik<=36)) then
  begin
    detik1 := detHijau - detik;

  Shape3.Brush.Color:=cllime;
  Shape2.Brush.Color:=clBlack;
  Shape1.Brush.Color:=clBlack;

  Label2.Caption:=IntToStr( detik1 );
  cxLabel2.Caption := IntToStr(detik);
  Timer1.Interval:=1000;

  end
  else if ((detik>=36)and(detik<=39)) then
  begin
    detik1 := detKuning - detik;

  Shape2.Brush.Color:=clyellow;
  Shape3.Brush.Color:=clBlack;
  Shape1.Brush.Color:=clBlack;

  Label2.Caption:=IntToStr(detik1);
  cxLabel2.Caption := IntToStr(detik);
  Timer1.Interval:=1000;
  end
  else if ((detik>=39)and(detik<=55)) then
  begin
    detik1 := detMerah - detik;

  Shape1.Brush.Color:=clred;
  Shape2.Brush.Color:=clBlack;
  Shape3.Brush.Color:=clBlack;

  Label2.Caption:=IntToStr(detik1);
  cxLabel2.Caption := IntToStr(detik);
  Timer1.Interval:=1000;
  end
  else
    begin
  detik:=0;
 end
end;

procedure Tfo_merah.cxLabel1Click(Sender: TObject);
begin
  fo_kelompok.show;
end;

end.