Groups
Groups
Sign in
Groups
Groups
ru-powershell
Conversations
About
Send feedback
Help
Windows.Forms это не просто, а очень просто.
9 views
Skip to first unread message
ajax76
unread,
Oct 19, 2008, 12:25:59 PM
10/19/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ru-powershell
[Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
function Form(){
param(
[hashtable]$properties,
[System.Windows.Forms.Control[]]$controls
)
$form=New-Object system.Windows.Forms.Form
if($properties){
$properties.keys | %{$form.$_=$properties[$_]}
}
if($controls){
$controls | %{$form.controls.add($_)}
}
return $form
}
function Control(){
param(
[string]$name,
[hashtable]$properties
)
$control=new-object $("System.Windows.Forms.$name")
if($properties){
$properties.keys | %{$control.$_=$properties[$_]}
}
return $control
}
Синтаксис:
Form [<[Hashtable] Properties>] [<[Control[]] Controls>]
Control [<String> Name] [<[Hashtable] Properties>]
Пример:
(Form @{
"text"="My Form";
"startposition"="centerscreen"
} @(Control "Label" @{
"text"="My Label";
"Location"=New-Object System.Drawing.Point(50,100)
}
)
).showdialog()
Продолжение следует ..?
Reply all
Reply to author
Forward
0 new messages