围绕Powershell 2.0 Panel的边界

时间:2016-11-23 20:30:11

标签: powershell powershell-v2.0

我有一个powershell 2.0 GUI,其面板的BorderType是BorderSingle。边框呈现黑色,但我希望它呈现白色,但我没有看到如何做到这一点。

$dataPanel = New-Object Windows.Forms.TableLayoutPanel
$dataPanel.BorderStyle = "FixedSingle"

1 个答案:

答案 0 :(得分:1)

谢谢@gravity

似乎是疏忽,你无法改变边框颜色!无论哪种方式,我都可以通过以下方式实现:

$dataPanel = New-Object Windows.Forms.TableLayoutPanel
$dataPanel.BorderStyle = "None"
$dataPanel.add_paint({$whitePen = new-object System.Drawing.Pen([system.drawing.color]::white, 3)
$_.graphics.drawrectangle($whitePen,$this.clientrectangle)
})