【发布时间】:2014-10-06 00:35:24
【问题描述】:
我正在使用 Powershell 和 Windows 窗体为我编写的一组脚本创建一个简单的 GUI。
我在 GUI 中生成了一堆按钮,目前正在为我的按钮添加样式。
$Button1 = New-Object System.Windows.Forms.Button
是否可以将以下行设置为所有按钮的全局/默认设置?
$Button1.Cursor = [System.Windows.Forms.Cursors]::Hand
$Button1.BackColor = '#CCCC99'
$Button1.Font = New-Object System.Drawing.Font("Verdana",10,[System.Drawing.FontStyle]::Bold)
给你一个想法,我现在正在做的是为每个按钮添加文本块。
$Button1.BackColor = '#CCCC99'
$Button2.BackColor = '#CCCC99'
$Button3.BackColor = '#CCCC99'
etc...
我很确定有更好、更有效的方法来做到这一点。谁能指出我正确的方向?
我希望所有按钮看起来都差不多。
提前致谢。
【问题讨论】:
标签: windows forms powershell button