PowerShell 表单不显示完整的标签消息
PowerShell Form not displaying full Label message
希望在我们正在应对的这些疯狂时期,每个人都安全并且过得很好。我有一个问题,如果你们能帮助我。我有一个表单,我想在我创建的按钮旁边显示一些文本。我为此使用了标签并添加了文本。问题是我的文字没有在表格中完整显示。带有文本的标签位于注释 INPUT USER INFO LABEL 下方。这是表格的图片,您可以看到“butt”上的文本截断应该是“button...”:
如您所见,我的表单中还剩下 space,但我的文本没有完全显示。我假设涉及尺寸,我设置的某种坐标弄乱了我的标签并将其切断。你们能帮我看看这件事,让我知道为什么会这样吗?提前谢谢你,和平与爱家人!!!!!
##################################### Form #####################################
# Create new form
$form = New-Object System.Windows.Forms.Form
# Add title to the window's form
$form.Text = 'Welcome to AD Mortgage Office 365 Testing Environment Version 1.0'
$form.Controls.Add($UserInfoLabel)
$form.Controls.Add($label)
# Add width and height of our window's popup in pixels
$form.Size = New-Object System.Drawing.Size(600,600)
$form.StartPosition = 'CenterScreen'
################################# Top Label ########################################
# Create a label
$label = New-Object System.Windows.Forms.Label
# Label Styles & Text
$label.Location = New-Object System.Drawing.Point(10,20)
$label.Size = New-Object System.Drawing.Size(280,20)
$label.Font = New-Object System.Drawing.Font("Calibri Light",15)
$label.Text = 'Please select an action:'
################################# CREATE INPUT USER INFO BUTTON #############################
# Store and create a "Create User" button
$InputUserInfo = New-Object System.Windows.Forms.Button
$InputUserInfo.Location = New-Object System.Drawing.Point(20,80)
$InputUserInfo.Size = New-Object System.Drawing.Size(100,50)
$InputUserInfo.Text = 'Input User Info'
$InputUserInfo.BackColor = "aqua"
$InputUserInfo.Add_Click($function:InputUserInfoButtonClick)
$form.AcceptButton = $InputUserInfo
$form.Controls.Add($InputUserInfo)
################################# INPUT USER INFO LABEL ########################################
# Create a label
$UserInfoLabel = New-Object System.Windows.Forms.Label
# Label Styles & Text
$UserInfoLabel.Location = New-Object System.Drawing.Point(130,95)
$UserInfoLabel.Size = New-Object System.Drawing.Size(280,20)
$UserInfoLabel.Font = New-Object System.Drawing.Font("Calibri Light",12)
$UserInfoLabel.Text = 'Please make sure you click the SAVE button on excel!'
################################# CREATE USER BUTTON #############################
# Store and create a "Create User" button
$CreateButton = New-Object System.Windows.Forms.Button
$CreateButton.Location = New-Object System.Drawing.Point(20,130)
$CreateButton.Size = New-Object System.Drawing.Size(100,50)
$CreateButton.Text = 'Create User'
$CreateButton.BackColor = "aqua"
$form.AcceptButton = $CreateButton
$form.Controls.Add($CreateButton)
################################## EDIT BUTTON ###################################
# Store and create "Edit User" button
$EditButton = New-Object System.Windows.Forms.Button
# Style Edit User button
$EditButton.Location = New-Object System.Drawing.Point(20,180)
$EditButton.Size = New-Object System.Drawing.Size(100,50)
$EditButton.Text = 'Edit User'
$EditButton.BackColor = "aqua"
$form.AcceptButton = $EditButton
$form.Controls.Add($EditButton)
################################ BLOCK BUTTON ####################################
# Store and create "Block User" button
$BlockButton = New-Object System.Windows.Forms.Button
# Style Edit User button
$BlockButton.Location = New-Object System.Drawing.Point(20,230)
$BlockButton.Size = New-Object System.Drawing.Size(100,50)
$BlockButton.Text = 'Block User'
$BlockButton.BackColor = 'aqua'
$form.Topmost = $true
$form.AcceptButton = $BlockButton
$form.Controls.Add($BlockButton)
################################# Bottom Label ########################################
# Create a label
$BottomLabel = New-Object System.Windows.Forms.Label
# Label Styles & Text
$BottomLabel.Location = New-Object System.Drawing.Point(10,300)
$BottomLabel.Size = New-Object System.Drawing.Size(280,50)
$BottomLabel.Font = New-Object System.Drawing.Font("Calibri Light",15)
$BottomLabel.Text = 'Output message:'
$form.Controls.Add($BottomLabel)
$form.ShowDialog()
根据 Santiago Squarzon 的要求,这是他的回答。只是在这里添加它,因为它是我问题的答案。
“文本似乎不适合您的标签大小,您是否尝试过调整。”
$UserInfoLabel.Size = New-Object System.Drawing.Size(280,20)
希望在我们正在应对的这些疯狂时期,每个人都安全并且过得很好。我有一个问题,如果你们能帮助我。我有一个表单,我想在我创建的按钮旁边显示一些文本。我为此使用了标签并添加了文本。问题是我的文字没有在表格中完整显示。带有文本的标签位于注释 INPUT USER INFO LABEL 下方。这是表格的图片,您可以看到“butt”上的文本截断应该是“button...”:
如您所见,我的表单中还剩下 space,但我的文本没有完全显示。我假设涉及尺寸,我设置的某种坐标弄乱了我的标签并将其切断。你们能帮我看看这件事,让我知道为什么会这样吗?提前谢谢你,和平与爱家人!!!!!
##################################### Form #####################################
# Create new form
$form = New-Object System.Windows.Forms.Form
# Add title to the window's form
$form.Text = 'Welcome to AD Mortgage Office 365 Testing Environment Version 1.0'
$form.Controls.Add($UserInfoLabel)
$form.Controls.Add($label)
# Add width and height of our window's popup in pixels
$form.Size = New-Object System.Drawing.Size(600,600)
$form.StartPosition = 'CenterScreen'
################################# Top Label ########################################
# Create a label
$label = New-Object System.Windows.Forms.Label
# Label Styles & Text
$label.Location = New-Object System.Drawing.Point(10,20)
$label.Size = New-Object System.Drawing.Size(280,20)
$label.Font = New-Object System.Drawing.Font("Calibri Light",15)
$label.Text = 'Please select an action:'
################################# CREATE INPUT USER INFO BUTTON #############################
# Store and create a "Create User" button
$InputUserInfo = New-Object System.Windows.Forms.Button
$InputUserInfo.Location = New-Object System.Drawing.Point(20,80)
$InputUserInfo.Size = New-Object System.Drawing.Size(100,50)
$InputUserInfo.Text = 'Input User Info'
$InputUserInfo.BackColor = "aqua"
$InputUserInfo.Add_Click($function:InputUserInfoButtonClick)
$form.AcceptButton = $InputUserInfo
$form.Controls.Add($InputUserInfo)
################################# INPUT USER INFO LABEL ########################################
# Create a label
$UserInfoLabel = New-Object System.Windows.Forms.Label
# Label Styles & Text
$UserInfoLabel.Location = New-Object System.Drawing.Point(130,95)
$UserInfoLabel.Size = New-Object System.Drawing.Size(280,20)
$UserInfoLabel.Font = New-Object System.Drawing.Font("Calibri Light",12)
$UserInfoLabel.Text = 'Please make sure you click the SAVE button on excel!'
################################# CREATE USER BUTTON #############################
# Store and create a "Create User" button
$CreateButton = New-Object System.Windows.Forms.Button
$CreateButton.Location = New-Object System.Drawing.Point(20,130)
$CreateButton.Size = New-Object System.Drawing.Size(100,50)
$CreateButton.Text = 'Create User'
$CreateButton.BackColor = "aqua"
$form.AcceptButton = $CreateButton
$form.Controls.Add($CreateButton)
################################## EDIT BUTTON ###################################
# Store and create "Edit User" button
$EditButton = New-Object System.Windows.Forms.Button
# Style Edit User button
$EditButton.Location = New-Object System.Drawing.Point(20,180)
$EditButton.Size = New-Object System.Drawing.Size(100,50)
$EditButton.Text = 'Edit User'
$EditButton.BackColor = "aqua"
$form.AcceptButton = $EditButton
$form.Controls.Add($EditButton)
################################ BLOCK BUTTON ####################################
# Store and create "Block User" button
$BlockButton = New-Object System.Windows.Forms.Button
# Style Edit User button
$BlockButton.Location = New-Object System.Drawing.Point(20,230)
$BlockButton.Size = New-Object System.Drawing.Size(100,50)
$BlockButton.Text = 'Block User'
$BlockButton.BackColor = 'aqua'
$form.Topmost = $true
$form.AcceptButton = $BlockButton
$form.Controls.Add($BlockButton)
################################# Bottom Label ########################################
# Create a label
$BottomLabel = New-Object System.Windows.Forms.Label
# Label Styles & Text
$BottomLabel.Location = New-Object System.Drawing.Point(10,300)
$BottomLabel.Size = New-Object System.Drawing.Size(280,50)
$BottomLabel.Font = New-Object System.Drawing.Font("Calibri Light",15)
$BottomLabel.Text = 'Output message:'
$form.Controls.Add($BottomLabel)
$form.ShowDialog()
根据 Santiago Squarzon 的要求,这是他的回答。只是在这里添加它,因为它是我问题的答案。
“文本似乎不适合您的标签大小,您是否尝试过调整。”
$UserInfoLabel.Size = New-Object System.Drawing.Size(280,20)