我有一个框架,其中包含一个带有标签的面板。当我扩展主机架时,我想我的面板也被扩展了。你能告诉我我能做什么吗?
function Show-tabcontrol_psf {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$tabcontrol1 = New-Object 'System.Windows.Forms.TabControl'
$tabpage1 = New-Object 'System.Windows.Forms.TabPage'
$tabpage2 = New-Object 'System.Windows.Forms.TabPage'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$form1_Load={
}
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$form1.remove_Load($form1_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch { Out-Null }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$form1.SuspendLayout()
$tabcontrol1.SuspendLayout()
#
# form1
#
$form1.Controls.Add($tabcontrol1)
$form1.AutoScaleDimensions = '6, 13'
$form1.AutoScaleMode = 'Font'
$form1.ClientSize = '453, 517'
$form1.Name = 'form1'
$form1.Text = 'Form'
$form1.add_Load($form1_Load)
#
# tabcontrol1
#
$tabcontrol1.Controls.Add($tabpage1)
$tabcontrol1.Controls.Add($tabpage2)
$tabcontrol1.Alignment = 'top'
$tabcontrol1.Location = '12, 12'
$tabcontrol1.Multiline = $True
$tabcontrol1.Name = 'tabcontrol1'
$tabcontrol1.SelectedIndex = 0
$tabcontrol1.Size = '429, 478'
$tabcontrol1.TabIndex = 0
#
# tabpage1
#
$tabpage1.Location = '42, 4'
$tabpage1.Name = 'tabpage1'
$tabpage1.Padding = '3, 3, 3, 3'
$tabpage1.Size = '583, 442'
$tabpage1.TabIndex = 0
$tabpage1.Text = 'tabpage1'
$tabpage1.UseVisualStyleBackColor = $True
#
# tabpage2
#
$tabpage2.Location = '23, 4'
$tabpage2.Name = 'tabpage2'
$tabpage2.Padding = '3, 3, 3, 3'
$tabpage2.Size = '602, 442'
$tabpage2.TabIndex = 1
$tabpage2.Text = 'tabpage2'
$tabpage2.UseVisualStyleBackColor = $True
#
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()
} #End函数
Show-tabcontrol_psf |空空
function Show-tabcontrol_psf {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$tabcontrol1 = New-Object 'System.Windows.Forms.TabControl'
$tabpage1 = New-Object 'System.Windows.Forms.TabPage'
$tabpage2 = New-Object 'System.Windows.Forms.TabPage'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$form1_Load={
}
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$form1.remove_Load($form1_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch { Out-Null }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$form1.SuspendLayout()
$tabcontrol1.SuspendLayout()
#
# form1
#
$form1.Controls.Add($tabcontrol1)
$form1.AutoScaleDimensions = '6, 13'
$form1.AutoScaleMode = 'Font'
$form1.ClientSize = '453, 517'
$form1.Name = 'form1'
$form1.Text = 'Form'
$form1.add_Load($form1_Load)
#
# tabcontrol1
#
$tabcontrol1.Controls.Add($tabpage1)
$tabcontrol1.Controls.Add($tabpage2)
$tabcontrol1.Alignment = 'top'
$tabcontrol1.Location = '12, 12'
$tabcontrol1.Multiline = $True
$tabcontrol1.Name = 'tabcontrol1'
$tabcontrol1.SelectedIndex = 0
$tabcontrol1.Size = '429, 478'
$tabcontrol1.TabIndex = 0
#
# tabpage1
#
$tabpage1.Location = '42, 4'
$tabpage1.Name = 'tabpage1'
$tabpage1.Padding = '3, 3, 3, 3'
$tabpage1.Size = '583, 442'
$tabpage1.TabIndex = 0
$tabpage1.Text = 'tabpage1'
$tabpage1.UseVisualStyleBackColor = $True
#
# tabpage2
#
$tabpage2.Location = '23, 4'
$tabpage2.Name = 'tabpage2'
$tabpage2.Padding = '3, 3, 3, 3'
$tabpage2.Size = '602, 442'
$tabpage2.TabIndex = 1
$tabpage2.Text = 'tabpage2'
$tabpage2.UseVisualStyleBackColor = $True
#
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()
} #End函数
Show-tabcontrol_psf |空空
答案 0 :(得分:0)
我的解决方案不完整
$TabControl.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Bottom
$TabControl.Anchor = [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Right
我必须收集这两行内容,问题才能解决。
答案 1 :(得分:0)
我有解决方法:
$TabControl.Anchor = [System.Windows.Forms.AnchorStyles]::Top
-bor [System.Windows.Forms.AnchorStyles]::Bottom
-bor [System.Windows.Forms.AnchorStyles]::Left
-bor [System.Windows.Forms.AnchorStyles]::Right