Pages

Diberdayakan oleh Blogger.
Banner4 Hosting Indonesia

Sabtu, 29 November 2014

Contoh Program Web Browser pada Delphi

  • Deskripsi Program

Program ini adalah program “WEB BROWSER” yang menggunakan menu bar didalamnya. Saat pertama kali program ini dijalankan maka akan tampil google.com sebagai tampilan awal. Program ini menggunakan menu bar yang berisi New, Open, Save, Print dan Close pada menu File; Stop, Refresh dan Find pada menu View; serta About pada menu Help. Selain itu, program ini juga menggunakan 11 tombol dengan fungsi yang berbeda di setiap tombolnya.
  • Interface Program

  • Code Program

Nama
Komponen
Event
Perintah
New1
OnClick
procedure TForm1.New1Click(Sender: TObject);
begin
webbrowser1.Navigate('www.google.com');
end;
Open1
OnClick
procedure TForm1.Open1Click(Sender: TObject);
begin
if opendialog1.Execute=true then
webbrowser1.Navigate(opendialog1.FileName);
end;
Save1
OnClick
procedure TForm1.Save1Click(Sender: TObject);
begin
if savedialog1.Execute=true then
webbrowser1.Navigate(savedialog1.FileName);
end;
Print1
OnClick
procedure TForm1.Print1Click(Sender: TObject);
begin
if printdialog1.Execute=true then
webbrowser1.action;
end;
Close1
OnClick
procedure TForm1.Close1Click(Sender: TObject);
begin
application.Terminate;
end;
Stop1
OnClick
procedure TForm1.Stop1Click(Sender: TObject);
begin
webbrowser1.Stop;
end;
Refresh1
OnClick
procedure TForm1.Refresh1Click(Sender: TObject);
begin
webbrowser1.Refresh;
end;
Find1
OnClick
procedure TForm1.Find1Click(Sender: TObject);
begin
if finddialog1.Execute=true then
webbrowser1.Navigate(finddialog1.FindText);
end;
About1
OnClick
procedure TForm1.About1Click(Sender: TObject);
begin
showmessage('Web Browser Versi 24.04.14');
end;
Button1
OnClick
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
webbrowser1.GoBack;
end;
Button2
OnClick
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
webbrowser1.GoForward;
end;
Button3
OnClick
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
webbrowser1.Navigate('www.google.com');
edit1.Text:='www.google.com';
end;
Button4
OnClick
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
webbrowser1.Stop;
end;
Button5
OnClick
procedure TForm1.BitBtn5Click(Sender: TObject);
begin
webbrowser1.Refresh;
end;
Button6
OnClick
procedure TForm1.BitBtn6Click(Sender: TObject);
begin
webbrowser1.Navigate('www.google.com');
end;
Button7
OnClick
procedure TForm1.BitBtn7Click(Sender: TObject);
begin
if opendialog1.Execute=true then
webbrowser1.Navigate(opendialog1.FileName);
end;
Button8
OnClick
procedure TForm1.BitBtn8Click(Sender: TObject);
begin
if savedialog1.Execute=true then
webbrowser1.Navigate(savedialog1.FileName);
end;
Button9
OnClick
procedure TForm1.BitBtn9Click(Sender: TObject);
begin
if finddialog1.Execute=true then
webbrowser1.Navigate(finddialog1.FindText);
end;
Button10
OnClick
procedure TForm1.BitBtn10Click(Sender: TObject);
begin
if printdialog1.Execute=true then
webbrowser1.action;
end;
Button11
OnClick
procedure TForm1.BitBtn11Click(Sender: TObject);
begin
webbrowser1.Navigate(edit1.Text);
end;
Form1
OnCreate
procedure TForm1.FormCreate(Sender: TObject);
begin
webbrowser1.Navigate('www.google.com');
end;
Webbrowser1
OnCommandStateChange
procedure TForm1.WebBrowser1CommandStateChange(Sender: TObject;
  Command: Integer; Enable: WordBool);
begin
edit1.Text:=webbrowser1.LocationURL;
case Command of
CSC_NAVIGATEBACK :
begin
bitbtn1.Enabled := Enable;
end;
CSC_NAVIGATEFORWARD :
begin
bitbtn2.Enabled := Enable;
end;end;end;

  • Output 

 Untuk download programnya, silahkan download (DISINI)

0 komentar:

Posting Komentar

Hosting Indonesia