我的换行符在我的文本框中无效

时间:2017-08-30 02:16:17

标签: powershell

现在花了几个小时和谷歌无法找出为什么这不起作用

当我放置`n`r时,它会突破该行,但您看不到该行的空白

我是PowerShell的新手我从网上获得了这个脚本,我试图稍微修改它

#==< StatusGroupBox >============================================================
$StatusGroupBox = New-Object System.Windows.Forms.GroupBox
$StatusGroupBox.Location = New-Object System.Drawing.Point(3, 220)
$StatusGroupBox.Size = New-Object System.Drawing.Size(272, 50)
$StatusGroupBox.TabStop = $True
$StatusGroupBox.Text = "Status"
#==< StatusBoxOutput >===========================================================
$StatusBoxOutput = New-Object System.Windows.Forms.Label
$StatusBoxOutput.BorderStyle = [System.Windows.Forms.BorderStyle]::None
$StatusBoxOutput.Font = New-Object System.Drawing.Font("Tahoma", 8.25, [System.Drawing.FontStyle]::Regular, `
                        [System.Drawing.GraphicsUnit]::Point, ([System.Byte](0)))
$StatusBoxOutput.Location = New-Object System.Drawing.Point(6, 235)
$StatusBoxOutput.Size = New-Object System.Drawing.Size(266, 14)
$StatusBoxOutput.Text = ""
$StatusBoxOutput.TextAlign = [System.Drawing.ContentAlignment]::MiddleCenter
$StatusBoxOutput.BackColor = [System.Drawing.SystemColors]::Menu
$StatusBoxOutput.ForeColor = "Black"
# Check if Computer Name is in FQDN format. (We want the FQDN so we can get the Domain Name.)
if ($ComputerName -notlike "*.*") {
        # Change Status Message.
        $AdmPasswordOutput.Text = "error"
        $PasswordExpiresOutput.Text = "n/a"
        $StatusBoxOutput.ForeColor = "Red"
        $StatusBoxOutput.Text = "Name must be a FQDN `ne.g. pc1$DefaultComputerFQDN'"
        $SearchButton.Enabled = $true # Enable Search button
        return
}

1 个答案:

答案 0 :(得分:1)

您必须在文本框中将Multiline属性设置为true。它们默认为单行。