Is there a simple way to have the titles like 'Version xx' displayed in bold? It's a bit annoying to start using labels for the titles, as the text will grow in time and has to be re-positioned every time then.
Code:
$P0Label2 = New-Object System.Windows.Forms.TextBox
$P0Label2.Location = New-Object System.Drawing.Point(8,28)
$P0Label2.Size = New-Object System.Drawing.Size(516,340)
$P0Label2.ReadOnly = $True
$P0Label2.WordWrap = $True
$P0Label2.ScrollBars = 'Vertical'
$P0Label2.Multiline = $True
$P0Label2.BackColor = 'LightSteelBlue'
$P0Label2.Text =
"Version 2.0:",
"- 2015/01/05 Stuff",
"- 2015/01/09 Stuff",
"Version 1.0:",
"- 2014/04/25 Stuff" | foreach {"$_`r`n"}
$P0.Controls.Add($P0Label2)
Thank you for your help.
Full solution thanks to Micky below:
$P0Label2 = New-Object System.Windows.Forms.RichTextBox
$P0Label2.Location = New-Object System.Drawing.Point(8,28)
$P0Label2.Size = New-Object System.Drawing.Size(516,340)
$P0Label2.ReadOnly = $True
$P0Label2.WordWrap = $True
$P0Label2.ScrollBars = 'Vertical'
$P0Label2.Multiline = $True
$P0Label2.BackColor = 'LightSteelBlue'
$P0Label2.Text =
"Version 2.0:",
"- 2015/01/05 Stuff",
"- 2015/01/09 Stuff",
"Version 1.0:",
"- 2014/04/25 Stuff" | foreach {"$_`r`n"}
"Version 2.0:",
"Version 1.0:" | foreach {
$oldFont = $P0Label2.Font
$font = New-Object Drawing.Font($oldFont.FontFamily, $oldFont.Size, [Drawing.FontStyle]::Bold)
$string = $_
$P0Label2.SelectionStart = $P0Label2.Text.IndexOf($string)
$P0Label2.SelectionLength = $string.length
$P0Label2.SelectionFont = $font
$P0Label2.DeselectAll()
}
$P0.Controls.Add($P0Label2)