Selamat datang di blog Strain alonso... Semoga apa yang ada diblog ini bermanfaat.

Pages

Saturday, April 14, 2012

Aplikasi Operasi File

unit U_pert4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, FileCtrl;

type
  TForm3 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    DirectoryListBox1: TDirectoryListBox;
    FileListBox1: TFileListBox;
    DriveComboBox1: TDriveComboBox;
    Bevel1: TBevel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    GroupBox1: TGroupBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    Button1: TButton;
    Button2: TButton;
    ColorDialog1: TColorDialog;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure FileListBox1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

var NamaFile:String;
Atribut:Integer;
{$R *.dfm}

procedure TForm3.BitBtn1Click(Sender: TObject);
begin
NamaFile:=edit1.Text;
Atribut:=FileGetAttr(NamaFile);
if Atribut and faReadOnly = faReadOnly then
checkbox1.Checked:=true
else
checkbox1.Checked:=false;
if Atribut and faHidden=faHidden then
checkbox2.Checked:=true
else
checkbox2.Checked:=false;
if atribut and faSysFile=faSysFile then
checkbox3.Checked:=true
else
checkbox3.Checked:=false
end;

procedure TForm3.BitBtn2Click(Sender: TObject);
begin

if checkbox1.Checked = true then
atribut:=atribut or faReadOnly
else
atribut:=atribut and not faReadOnly;

if checkbox2.Checked=true then
atribut:=atribut or faHidden
else
atribut:=atribut and not faHidden;

if checkbox3.Checked = true then
atribut:=atribut or faSysFile
else
atribut:=atribut and not faSysFile;
FileSetAttr(NamaFile,Atribut);
end;

procedure TForm3.BitBtn3Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TForm3.Button1Click(Sender: TObject);
begin
if application.MessageBox('Apakah Anda Ingin Keluar?','Warning',36)=idyes then
close;
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
colordialog1.Execute();
form3.Color:=colordialog1.Color;
end;

procedure TForm3.FileListBox1Change(Sender: TObject);
begin
BitBtn1Click(self);
end;

end.

Aplikasi Operasi Teks


 


LIST IS AS FOLLOWS :

 
unit u_pert2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    GroupBox1: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    RadioButton6: TRadioButton;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    Button3: TButton;
    Button4: TButton;
    ColorDialog1: TColorDialog;
    Button5: TButton;
    ComboBox4: TComboBox;
    ComboBox5: TComboBox;
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure ComboBox3Change(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
    procedure RadioButton4Click(Sender: TObject);
    procedure RadioButton5Click(Sender: TObject);
    procedure RadioButton6Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure ComboBox4Change(Sender: TObject);
    procedure ComboBox5Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Text:=uppercase(edit1.Text);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
memo1.Text:=lowercase(edit1.Text);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
if application.MessageBox('Apakah Anda Ingin Keluar?','Warning',36)=idyes then
close;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
colordialog1.Execute();
form1.Color:=colordialog1.Color;

end;

procedure TForm1.Button5Click(Sender: TObject);
begin
colordialog1.Execute();
memo1.Font.Color:=colordialog1.Color;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
memo1.font.Name:=combobox1.Text;
end;

procedure TForm1.ComboBox2Change(Sender: TObject);
begin
memo1.Font.Size:=strtoint(combobox2.Text);
end;

procedure TForm1.ComboBox3Change(Sender: TObject);
begin
if combobox3.Text='Merah' then
memo1.Color:=clred
else if combobox3.Text='Biru' then
     memo1.Color:=clblue
     else memo1.Color:=clgreen;
end;

procedure TForm1.ComboBox4Change(Sender: TObject);
begin
if combobox4.Text='Bold' then
memo1.Font.Style:=memo1.Font.Style+[fsbold]
else if combobox4.Text='Italic' then
memo1.Font.Style:=memo1.Font.Style+[fsitalic]
else if combobox4.Text='Underline' then
memo1.Font.Style:=memo1.Font.Style+[fsunderline]
else if combobox4.Text='Strikeout' then
memo1.Font.Style:=memo1.Font.Style+[fsstrikeout]
else
memo1.Font.Style:=memo1.Font.Style-[fsbold,fsitalic,fsunderline,fsstrikeout];
end;

procedure TForm1.ComboBox5Change(Sender: TObject);
begin
if combobox5.Text='Tengah' then
memo1.Alignment:=tacenter
else if combobox5.Text='Rata Kanan' then
memo1.Alignment:=taRightJustify
else
memo1.Alignment:=taLeftJustify;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.Items:=screen.Fonts;
combobox1.Text:='-PILIH FONTS-';
combobox2.Text:='-PILIH SIZE-';
combobox3.Text:='-PILIH BACK COLOR-';
combobox4.Text:='-PILIH STYLE FONT-';
combobox5.Text:='-PILIH POSITION TEXT-';
end;

procedure TForm1.RadioButton1Click(Sender: TObject);
begin
memo1.Font.Color:=clred;
end;

procedure TForm1.RadioButton2Click(Sender: TObject);
begin
memo1.Font.Color:=clgreen;
end;

procedure TForm1.RadioButton3Click(Sender: TObject);
begin
memo1.Font.Color:=clyellow;
end;

procedure TForm1.RadioButton4Click(Sender: TObject);
begin
memo1.Font.Color:=clpurple;
end;

procedure TForm1.RadioButton5Click(Sender: TObject);
begin
memo1.Font.Color:=clblack;
end;

procedure TForm1.RadioButton6Click(Sender: TObject);
begin
memo1.Font.Color:=clblue;
end;

end.

Game Menangkap Anjing

unit U_pert1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls, GIFImg, pngimage, u_pert2;

type
  TBENSAN = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Timer1: TTimer;
    Button3: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image2Click(Sender: TObject);
    procedure Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image3MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image4Click(Sender: TObject);
    procedure Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image1Click(Sender: TObject);
    procedure Image3Click(Sender: TObject);
    procedure Image4MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image5Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
     procedure aktif;
     procedure nonaktif;
  end;

var
  BENSAN: TBENSAN;

implementation

{$R *.dfm}

procedure TBENSAN.aktif;
begin
  image1.enabled:=true;
  image2.enabled:=true;
  image3.enabled:=true;
  image4.enabled:=true;
  image5.enabled:=true;
  button2.enabled:=true;
  image1.visible:=true;
  image2.visible:=true;
  image3.visible:=true;
  image4.visible:=true;
  image5.visible:=true;
end;

procedure TBENSAN.nonaktif;
begin
  image1.enabled:=false;
  image2.enabled:=false;
  image3.enabled:=false;
  image4.enabled:=false;
  image5.enabled:=false;
  edit1.Enabled:=false;
  button2.Enabled:=false;
end;

procedure TBENSAN.Timer1Timer(Sender: TObject);
begin
nonaktif;
timer1.enabled:=false;
edit1.Text:='0';
messagedlg('maaf anda kalah',mtinformation,[mbOk],0);
end;

procedure TBENSAN.Button1Click(Sender: TObject);
begin
timer1.Interval:=10000;
timer1.Enabled:=true;
Aktif;
end;

procedure TBENSAN.Button2Click(Sender: TObject);
begin
nonaktif;
timer1.Enabled:=false;
end;

procedure TBENSAN.Button3Click(Sender: TObject);
begin
if application.MessageBox('Apakah Anda Ingin Keluar?','Pesan',36)=idyes then
close;
end;

procedure TBENSAN.Edit1Change(Sender: TObject);
begin
if edit1.Text='100' then
begin
  nonaktif;
  timer1.Enabled:=false;
  application.MessageBox('Selamat Anda Menang','Pesan',64);
  edit1.Text:='0';
end;
end;

procedure TBENSAN.FormCreate(Sender: TObject);
begin
timer1.Enabled:=false;
nonaktif;
end;

procedure TBENSAN.Image1Click(Sender: TObject);
begin
image1.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TBENSAN.Image2Click(Sender: TObject);
begin
image2.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TBENSAN.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image1.Left:=random(left);
image1.Top:=random(top);
end;

procedure TBENSAN.Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image2.Left:=random(left);
image2.Top:=random(top);
end;

procedure TBENSAN.Image3Click(Sender: TObject);
begin
image3.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TBENSAN.Image3MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image3.Left:=random(left);
image3.Top:=random(top);
end;

procedure TBENSAN.Image4Click(Sender: TObject);
begin
image4.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);

end;

procedure TBENSAN.Image4MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image4.Left:=random(left);
image4.Top:=random(top);
end;

procedure TBENSAN.Image5Click(Sender: TObject);
begin
image5.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TBENSAN.Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image5.Left:=random(left);
image5.Top:=random(top);
end;

end.