Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tablelayoutpanel in powershell

481 views
Skip to first unread message

Robert

unread,
Apr 8, 2008, 6:30:02 AM4/8/08
to
In powershell I want to use a tablelayoutpanel with 2 rows and 2 columns and
all rows should have the same size. But the script does't work:

[System.Reflection.Assembly]::LoadWithPartialName("System.windows.Forms")
$form = new-object "System.Windows.Forms.Form"
$form.Size = new-object System.Drawing.Size @(200,200)
$Bereich = new-object "System.Windows.Forms.TableLayoutPanel"
$Bereich.Dock = "Fill"
$Bereich.RowCount = 2
$Bereich.ColumnCount = 2
$Bereich.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33333F))
$form.Controls.Add($Bereich)
$form.showdialog()

Has anyone an idea?

Marco Shaw [MVP]

unread,
Apr 9, 2008, 8:00:43 AM4/9/08
to

> $Bereich.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33333F))

The oddity seems to be the above line. I've never used that before.
I've not spent much time on it, but I'll try to look at it again if
you're not in a big rush. It could only be tomorrow night though.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com

Robert

unread,
Apr 10, 2008, 3:45:01 PM4/10/08
to
Solution:

[System.Reflection.Assembly]::LoadWithPartialName("System.windows.Forms")
$form = new-object "System.Windows.Forms.Form"
$form.Size = new-object System.Drawing.Size @(200,200)
$Bereich = new-object "System.Windows.Forms.TableLayoutPanel"
$Bereich.Dock = "Fill"

$Bereich.CellBorderStyle = "Single"


$Bereich.RowCount = 2
$Bereich.ColumnCount = 2

$Bereich.RowStyles.Add((new-object
System.Windows.Forms.RowStyle([System.Windows.Forms.SizeType]::Percent, 50)))
$Bereich.RowStyles.Add((new-object
System.Windows.Forms.RowStyle([System.Windows.Forms.SizeType]::Percent, 50)))
$Bereich.ColumnStyles.Add((new-object
System.Windows.Forms.ColumnStyle([System.Windows.Forms.SizeType]::Percent,
50)))
$Bereich.ColumnStyles.Add((new-object
System.Windows.Forms.ColumnStyle([System.Windows.Forms.SizeType]::Percent,
50)))
$form.Controls.Add($Bereich)
$form.showdialog()

0 new messages