Saturday, September 15, 2012

Membalik Text

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    B1: TButton;
    procedure B1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function RS(const AText: string): string;
var
  I: Integer;
  C: PChar;
begin
  SetLength(Result, Length(AText));
  C := PChar(Result);
  for I := Length(AText) downto 1 do
  begin
    C^ := AText[I];
    Inc(C);
  end;
end;

procedure TForm1.B1Click(Sender: TObject);
begin
   Form1.Caption := RS(Form1.Caption);
   B1.Caption := RS(B1.Caption);
end;

end.

Friday, June 29, 2012

Membuat Button/Tombol unik

unit Unit1;

interface

uses
   SysUtils, Graphics, Forms, StdCtrls, Classes, Controls, ExtCtrls;

type
  TForm1 = class(TForm)
    PB: TPaintBox;
    E1: TEdit;
    procedure PBPaint(Sender: TObject);
    procedure PBMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure PBMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormCreate(Sender: TObject);
  private
    { By : Zephio }
  public
    { http://amateur-guide.blogspot.com }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.PBPaint(Sender: TObject);
begin
with PB.Canvas do
begin
   Brush.Style := BSClear;
   Pen.Style := PSSolid;
   Font.Size := 24;
   Font.Style := [FSBold];
   Font.Name := 'Verdana';
   Font.Color := ClGray;
   TextOut(0, 0, 'Generate');
   Font.Color := CLBlue;
   TextOut(2, 2, 'Generate');
end;
end;

procedure TForm1.PBMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
with PB.Canvas do
begin
   Brush.Style := BSClear;
   Pen.Style := PSSolid;
   Font.Size := 24;
   Font.Style := [FSBold];
   Font.Name := 'Verdana';
   Font.Color := ClGray;
   TextOut(0, 0, 'Generate');
   Font.Color := CLRed;
   TextOut(2, 2, 'Generate');
end;

end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
   PBPaint(Self);
end;

procedure TForm1.PBMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if Button <> MBLeft then
   Exit
else
with PB.Canvas do
begin
   Brush.Style := BSClear;
   Pen.Style := PSSolid;
   Font.Size := 24;
   Font.Style := [FSBold];
   Font.Name := 'Verdana';
   Font.Color := ClGray;
   TextOut(0, 0, 'Generate');
   Font.Color := ClLIme;
   TextOut(2, 2, 'Generate');
end;
   E1.Text := IntToHex(Random(999999), 8);
   E1.Font.Color := Random(99999);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   DoubleBuffered := true;
   Randomize;
end;

end.

Sunday, July 31, 2011

Jam

unit Unit1;

interface

uses
Windows, SysUtils, Graphics, Forms, ExtCtrls, Classes;

type
TForm1 = class(TForm)
Timer1: TTimer;
procedure FormPaint(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ By : Zephio
Bikin Jam Unik tp jelek }
public
{ http://amateur-guide.blogspot.com }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.FormPaint(Sender: TObject);
begin
with Form1 do
//------------------------------------------------------------------------------>
// Lingkar Jam
Canvas.Brush.Color := CLTeal;
Canvas.Pen.Color := ClBlue;
Canvas.Ellipse(0, 25, ClientWidth, ClientHeight Div 2);
Canvas.Brush.Color := clFuchsia;
Canvas.Ellipse(0, 25, ClientWidth - 10, ClientHeight Div 2 - 10);
//------------------------------------------------------------------------------>
// Per Detik
Canvas.Pen.Color := clBlue;
Canvas.MoveTo(StrToInt(FormatDateTime('ss', Now)),25);
Canvas.LineTo(StrToInt(FormatDateTime('ss', Now)),ClientHeight Div 2 - 15);
//------------------------------------------------------------------------------>
Canvas.Font.Color := clBlue;
Canvas.Font.Style := [fsBold];
SetBkMode(Canvas.Handle,TRANSPARENT);
Canvas.TextOut(StrToInt(FormatDateTime('ss', Now)), ClientHeight Div 2 - 15, FormatDateTime('ss', Now));
//------------------------------------------------------------------------------>
// Per Menit
Canvas.Pen.Color := clRed;
Canvas.MoveTo(StrToInt(FormatDateTime('nn', Now)),25);
Canvas.LineTo(StrToInt(FormatDateTime('nn', Now)),ClientHeight Div 2 - 30);
//------------------------------------------------------------------------------>
Canvas.Font.Color := clRed;
Canvas.Font.Style := [fsBold];
SetBkMode(Canvas.Handle,TRANSPARENT);
Canvas.TextOut(StrToInt(FormatDateTime('nn', Now)), ClientHeight Div 2 - 30, FormatDateTime('nn', Now));
//------------------------------------------------------------------------------>
//Per Jam
Canvas.Pen.Color := clBlack;
Canvas.MoveTo(StrToInt(FormatDateTime('hh', Now)),25);
Canvas.LineTo(StrToInt(FormatDateTime('hh', Now)), ClientHeight Div 2 - 45);
//------------------------------------------------------------------------------>
Canvas.Font.Color := clBlack;
Canvas.Font.Style := [fsBold];
SetBkMode(Canvas.Handle,TRANSPARENT);
Canvas.TextOut(StrToInt(FormatDateTime('hh', Now)), ClientHeight Div 2 - 45, FormatDateTime('hh', Now));
//------------------------------------------------------------------------------>
// Pesan
Canvas.Brush.Style := BSClear;
Canvas.Font.Color := CLRed;
Canvas.Font.Size := 12;
Canvas.TextOut(ClientWidth Div 3 + 15, 0, 'Clock');
Canvas.Font.Color := CLBlue;
Canvas.Font.Size := 12;
Canvas.TextOut(ClientWidth Div 5, 140, 'Created By : Zephio');
//------------------------------------------------------------------------------>
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
Invalidate;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Application.Title := 'ZS Clock';
Form1.Height := 280;
Form1.Width := 256;
DoubleBuffered := true;
end;

end.

Transparent Form

unit Unit1;

interface

uses
Windows, Graphics, Forms;

type
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ By : Zephio
Membuat Form Tembus Pandang dgn Canvas}
public
{ http://amateur-guide.blogspot.com }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormPaint(Sender: TObject);
begin
with Form1.Canvas do
begin
Brush.Style := BSClear;
Brush.Color := clFuchsia;
Pen.Color := ClYellow;
Rectangle(0 , 0, Form1.ClientWidth, Form1.ClientHeight);
Rectangle(10, 10, Form1.ClientWidth - 10, Form1.ClientHeight - 10);
Rectangle(20, 20, Form1.ClientWidth - 20, Form1.ClientHeight - 20);
Rectangle(30, 30, Form1.ClientWidth - 30, Form1.ClientHeight - 30);
Rectangle(40, 40, Form1.ClientWidth - 40, Form1.ClientHeight - 40);
Rectangle(50, 50, Form1.ClientWidth - 50, Form1.ClientHeight - 50);
Rectangle(60, 60, Form1.ClientWidth - 60, Form1.ClientHeight - 60);
Rectangle(70, 70, Form1.ClientWidth - 70, Form1.ClientHeight - 70);
Rectangle(80, 80, Form1.ClientWidth - 80, Form1.ClientHeight - 80);
Rectangle(90, 90, Form1.ClientWidth - 90, Form1.ClientHeight - 90);
Rectangle(100, 100, Form1.ClientWidth - 100, Form1.ClientHeight - 100);
end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Application.Title := 'ZS Form';
end;

end.

Animasi Form

unit Unit1;

interface

uses
SysUtils, Forms, ExtCtrls, Classes;

type
TForm1 = class(TForm)
T1: TTimer;
procedure FormCreate(Sender: TObject);
procedure T1Timer(Sender: TObject);
private
{ Created By : Zephio }
public
{ Title : Anime Form }
{ http://amateur-guide.blogspot.com }
end;

var
Form1: TForm1;

implementation


{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
Tag := 40; // Set Form1.Tag = 40, pembatasan Minimal 40, jk dr 0 kelamaan!...
end;

procedure TForm1.T1Timer(Sender: TObject);
begin
Tag := Tag + 1; //kalk 40..300
Width := Tag * 2; //Lebar 300 x 2 = 600
Height := Tag; //Tinggi 300
Caption := 'Time : '+IntToStr(Tag)+' Width : '+IntToStr(Width)+' Height : '+IntToStr(Height);
if Tag = 300 then // jk value Tag(40..300) = 300 (Penentuan value Maximal) maka Timer1 = Disable/Tidak Aktif
begin
T1.Enabled := false;
Caption := 'Anime Form, By : Zephio, Form Status : Ready';
end;

end;

end.

Check Nilai 2

unit Unit1;

interface

uses
Windows, SysUtils, Graphics, Forms, StdCtrls, ExtCtrls, Controls, Classes;

type
TForm1 = class(TForm)
// Componnent yg diperlukan----------------------------------------------------->
E1: TEdit;
S1: TShape;
procedure E1Change(Sender: TObject);
private
{ By : Zephio
Check Nilai antara 1..100 }
public
{ http://amateur-guide.blogspot.com }
end;

var
Form1: TForm1;

implementation



{$R *.dfm}

procedure TForm1.E1Change(Sender: TObject);
var
I : Integer;
begin
E1.MaxLength := 3; //Batas Maximal Input adalah 3 Digit / [0..999]
I := StrToInt(E1.Text); //I = Input Nilai
case I of
// Dengan Text
1..20 : Caption := 'E = Sangat Payah'; // Jika Input Antara 1 hingga 20 maka tampilkan Pesan E
21..40 : Caption := 'D = Payah'; // Jika Input Antara 21 hingga 40 maka tampilkan Pesan D
41..60 : Caption := 'C = Lumayan'; // Jika Input Antara 41 hingga 60 maka tampilkan Pesan C
61..80 : Caption := 'B = Bagus'; // Jika Input Antara 61 hingga 80 maka tampilkan Pesan B
81..100 : Caption := 'A = Sempurna'; // Jika Input Antara 81 hingga 100 maka tampilkan Pesan A
0, 101..999 : Caption := '? = Diluar Nilai'; // Jika Input adalah 0 Antara 101 hingga 999 maka Pengecualian
else
Caption := '';
end;
case I of
// Dengan Color
1..20 : S1.Brush.Color := ClRed;
21..40 : S1.Brush.Color := clFuchsia;
41..60 : S1.Brush.Color := ClYellow;
61..80 : S1.Brush.Color := ClBlue;
81..100 : S1.Brush.Color := ClGreen;
0, 101..MaxInt : S1.Brush.Color := ClBlack;
else
S1.Brush.Color := ClWhite;
end;
end;

end.

Monday, July 11, 2011

Penghitung Nilai [4 Rega]


unit Unit1;

interface

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

type
TForm1 = class(TForm)
//----------- Componnent yg dipakai--------------------------------------------->
Edit1: TEdit;
SpeedButton1: TSpeedButton;
Label1: TLabel;
Shape1: TShape;
Label2: TLabel;
//----------- Componnent yg dipakai--------------------------------------------->
procedure SpeedButton1Click(Sender: TObject);
private
{ Create By : Zephio }
public
{ http://amateur-guide.blogspot.com }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.SpeedButton1Click(Sender: TObject);
var
I : Integer;
begin
I := StrToInt(Edit1.Text);
if (I <= 20) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClRed;
Label2.Caption := 'E = Sangat Payah';
Label2.Font.Color := ClRed
end
else
if (I <= 40) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClYellow;
Label2.Caption := 'D = Payah';
Label2.Font.Color := ClYellow
end
else
if (I <= 60) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClBlack;
Label2.Caption := 'C = Cukup';
Label2.Font.Color := ClBlack
end
else
if (I <= 80) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClBlue;
Label2.Caption := 'B = Bagus';
Label2.Font.Color := ClBlue
end
else
if (I <= 100) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClGreen;
Label2.Caption := 'A = Sangat Bagus';
Label2.Font.Color := ClGreen;
end;
end;
end.
DL SC : Click Here