Powershell在按钮

时间:2017-04-07 15:03:46

标签: powershell

我试图在Powershell中创建Form。但我无法弄清楚当我有图像时,如何从按钮中删除填充?正如你在图片上看到的那样。按钮的图片和边框之间有空格。我该如何删除它?

http://imgur.com/a/5zhuN

$Item1But = New-Object system.windows.Forms.Button
$Item1But.Text = "Keyboard"
$Item1But.Width = 250
$Item1But.Height = 50
$Item1But.Image = [System.Drawing.Image]::Fromfile(".\Picture\Keyboard.gif")
$Item1But.TextImageRelation = "ImageBeforeText"
$Item1But.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
$Item1But.FlatAppearance.BorderSize=2
$Item1But.FlatAppearance.Bordercolor="red"
$Item1But.location = new-object system.drawing.point(25,25)
$Item1But.Font = "Microsoft Sans Serif,25"
$Item1But.add_click($NewAction)
$Form.controls.Add($Item1But)

1 个答案:

答案 0 :(得分:0)

以下是MSDN on Padding

$Item1But.Padding = New-Object -TypeName System.Windows.Forms.Padding -ArgumentList (0,0,0,0)