|
<?
import namespace System;
import namespace System:::Drawing;
import namespace System:::Windows:::Forms;
import namespace HelloWindows;
namespace HelloWindows
{
// Funkce na vytvareni ovladacich prvku
function CreateCtrl($name, $ctrls, $props)
{
$ctl = new $name;
foreach(array_keys($props) as $prop)
$ctl->$prop = $props[$prop];
$ctrls->Add($ctl);
return $ctl;
}
// Hlavni okno aplikace
class MainForm extends System:::Windows:::Forms:::Form
{
var $txt;
var $btn;
var $web;
function __construct()
{
$this->InitializeComponent();
}
function InitializeComponent()
{
$this->SuspendLayout();
$this->ClientSize = new Size(800, 600);
$this->Name = 'MainFrom';
$this->Text = 'PHP Web Browser';
$this->txt = CreateCtrl("TextBox", $this->Controls, array(
"Left" => 10, "Top" => 10, "Width" => 700, "Height" => 22,
"Anchor" => (AnchorStyles::Right | AnchorStyles::Top | AnchorStyles::Left) ));
$this->btn = CreateCtrl("Button", $this->Controls, array(
"Left" => 720, "Top" => 10, "Width" => 70, "Height" => 22, "Text" => "Go!",
"Anchor" => (AnchorStyles::Right | AnchorStyles::Top) ));
$this->btn->Click->Add(new EventHandler(array($this, "btnClicked")));
$this->web = CreateCtrl("WebBrowser", $this->Controls, array(
"Left" => 10, "Top" => 40, "Width" => 780, "Height" => 540,
"Anchor" => (AnchorStyles::Left | AnchorStyles::Right | AnchorStyles::Top | AnchorStyles::Bottom) ));
$this->ResumeLayout(false);
$this->PerformLayout();
}
function btnClicked()
{
$this->web->Navigate($this->txt->Text);
}
}
}
?>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I live in Prague, the capital city of Czech republic (most of the time
). I've been very interested in functional programming recently and I have a passion for the new Microsoft F# language. I'm writing a book about
Functional Programming in the Real World that shows the ideas using examples in C# 3.0 and F#.
I've been Microsoft MVP (for C#) since 2004 and I'm one of the most active members of the F# community. I'm a computer science student at
Charles University of Prague. My hobbies include photography, fractals and of course many things related to computers (except fixing them). My favorite book writers are Terry Pratchett and Philip K Dick and I like paintings by M. C. Escher.
PS: My favorite codeproject icon is .