Char(DesertFish)

A desert-fish want to go heaven.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

cls
function HelloWord{
  [System.Windows.Forms.MessageBox]::Show("Hello world!")
}


[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

$app=[System.Windows.Forms.Application];

$myForm=new-object System.Windows.Forms.Form;
$myForm.Text="my window";

$button1 = new-object System.Windows.Forms.Button;
$button1.Size = new-object System.Drawing.Size  -argumentlist 75, 23;
$button1.Text = "点我试试";

$textbox1=new-object System.Windows.Forms.TextBox;
$textBox1.Multiline = $true;
$textBox1.Text = "hello world";
$textBox1.Size = new-object System.Drawing.Size  -argumentlist 281, 227;

$flowLayoutPanel1 = new-object System.Windows.Forms.FlowLayoutPanel;
$myForm.Controls.Add($flowLayoutPanel1)
$flowLayoutPanel1.Controls.Add($textBox1);
$flowLayoutPanel1.Controls.Add($button1);
$flowLayoutPanel1.Dock = "Fill";
$flowLayoutPanel1.FlowDirection = "TopDown";
$button1ClickEventHandler = [System.EventHandler] {
param
 (
       [Object] $sender,
       [EventArgs] $e
    )
    [System.Windows.Forms.MessageBox]::Show("Hello world!");
}

#$button1.Add_Click($button1ClickEventHandler);

$button1.Add_Click({HelloWord});

#$button1.Add_Click(
#{
#[System.Windows.Forms.MessageBox]::Show("Hello world!");
#}
#);

$app::EnableVisualStyles()
$app::Run($myForm)

 

posted on 2010-12-16 16:25  沙漠鱼  阅读(347)  评论(0编辑  收藏  举报