{$apptype windows}
{$reference 'System.Windows.Forms.dll'}
{$reference 'System.Drawing.dll'}
{$reference 'System.dll'}
uses System.Windows.Forms,
System.Drawing,System.ComponentModel,System.Net,
System;
var myForm: Form;
var myTextBox: TextBox;
var myButton:Button;
var myWebBrowser:WebBrowser;
var baseUri:Uri;
var stRect:System.Drawing.Rectangle;
procedure OnClick(sender: object; e: System.EventArgs);
begin
baseUri := new Uri(myTextBox.Text);
myWebBrowser.Url := baseUri;
end;
procedure FNewWindow(sender: object; e: CancelEventArgs);
begin
baseUri := new Uri(myWebBrowser.StatusText.ToString());
myWebBrowser.Url := baseUri;
myTextBox.Text := myWebBrowser.StatusText.ToString();
e.Cancel := true;
end;
begin
myForm := new Form;
myForm.Text := '‘Форма';
myForm.WindowState := FormWindowState.Maximized;
stRect:= System.Windows.Forms.Screen.PrimaryScreen.Bounds;
myTextBox := new TextBox;
myTextBox.Text := 'http://www.google.ru/';
myTextBox.Width := stRect.Width - myTextBox.Width;
myTextBox.Top := 25;
myForm.Controls.Add(myTextBox);
myButton := new Button;
myButton.Text := 'go';
myButton.Top := 22;
myButton.Click += OnClick;
myForm.Controls.Add(myButton);
myWebBrowser := new WebBrowser;
myWebBrowser.Top := 50;
myWebBrowser.Width := stRect.Width;
myWebBrowser.Height := stRect.Height;
myButton.Left := stRect.Width - myButton.Width;
myWebBrowser.NewWindow += FNewWindow;
myWebBrowser.ScriptErrorsSuppressed := true;
myForm.Controls.Add(myWebBrowser);
Application.Run(myForm);
end.
|