Di Delphi kita dapat membuat tombol jenis ini.
Buat sebuah aplikasi baru, letakkan sebuah tombol di form. Berikut adalah perintah lengkapnya.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
jalan:boolean;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
jalan:=not(jalan);
if jalan=true then button1.Caption:='stop' else button1.Caption:='jalan';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
jalan:=false;
end;
end.
No comments:
Post a Comment