After creating a panel I need to add some text to it. To do this I use a Label
, and this works great when I know the quantity of text I need to publish. However, at times it's unknown how much characters of text need to be visible in the label. So it would be nice if there was a way to have a scroll-bar in the label, so users can scroll to the end of it if they want to read all of the text.
As you can see below, I tried to do it by setting the AutoSize
to $True
and a fixed MaximumSize
. But this doesn't bring up the necessary scroll-bar..
Label:
$Label = New-Object System.Windows.Forms.Label
$Label.Location = New-Object System.Drawing.Point(8,26)
$Label.MaximumSize = New-Object System.Drawing.Size(528,50)
$Label.AutoSize = $True
$Label.Text = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd STOP"
#$Label.Text = (Get-Help $MyScript).Description | Out-String
$Label.BackColor = 'Transparent'
$Label.TextAlign = 'TopLeft'
$Panel.Controls.Add($Label)
I found a similar thread, but this only talks about word wrapping and not about scroll-bars.
Thank you for your help.