WWW浏览器

procedure TForm1.Button1Click(Sender: TObject);
begin

//打开网页
  WebBrowser1.Navigate(Edit1.Text);
end;

procedure TForm1.ToolButton8Click(Sender: TObject);
begin

//退出程序
  Close;
end;

procedure TForm1.ToolButton1Click(Sender: TObject);
begin
  Try

//向前浏览
    WebBrowser1.GoBack;
  except
    showmessage('已经达到最早历史纪录。');
    exit;
  end;

end;

procedure TForm1.ToolButton2Click(Sender: TObject);
begin
   Try

//向后浏览
     WebBrowser1.GoForward;
   except
     showmessage('已经达到最后历史纪录。');
     exit;
   end;

end;

procedure TForm1.ToolButton4Click(Sender: TObject);
begin

//停止浏览
  WebBrowser1.Stop;
end;

procedure TForm1.ToolButton5Click(Sender: TObject);
begin

//刷新
  WebBrowser1.Refresh;
end;

procedure TForm1.ToolButton6Click(Sender: TObject);
begin

//返回首页
  WebBrowser1.GoHome;
end;

procedure TForm1.WebBrowser1DownloadBegin(Sender: TObject);
begin

//正在连接地址
     StatusBar1.Panels[0].Text:='正在连接地址:'+Edit1.text;
end;

procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
begin

//OK
   StatusBar1.Panels[0].Text:='完成'+WebBrowser1.LocationURL ;
end;

你可能感兴趣的:(浏览器)