Answered by:
Formating Text into a textbox

Question
-
Hello everyone,
How can i modify each variable with different font size and types, like bold.
I have a textbox and different text, each one needs to be different but i only able to change the property of the textbox and not the variables.
$text1 = "Example"
$text2 = "Exmaple2"
$text3 = "Example3"
$ritchtextbox.text = $text1 + $text2 (bold) + $text3 (Font size 16)
can this be possible?
Thursday, April 11, 2019 12:34 PM
Answers
-
See the instructions for the RTB here: https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.richtextbox.selectionfont?view=netframework-4.7.2
\_(ツ)_/
- Marked as answer by D.M.L Thursday, April 11, 2019 1:19 PM
Thursday, April 11, 2019 12:57 PM -
You have to be sure the selection point is at the end or where you want it. If the I age is selected after the paste then the next assignment will replace the image.
\_(ツ)_/
- Marked as answer by D.M.L Thursday, April 11, 2019 3:40 PM
Thursday, April 11, 2019 2:54 PM
All replies
-
See the instructions for the RTB here: https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.richtextbox.selectionfont?view=netframework-4.7.2
\_(ツ)_/
- Marked as answer by D.M.L Thursday, April 11, 2019 1:19 PM
Thursday, April 11, 2019 12:57 PM -
Thanks, I've read that info and helped me to work with the text edition!.
best regards
Thursday, April 11, 2019 1:19 PM -
me again, i have an issue after editing the text, before sending the variables into the rtb i paste an image into it, after that ,once the text is added, the image disappear, how can I paste the text below it without losing it?
New-QR -Message $TQRmsj -Size L -fileName "$env:temp\$file.png" $logo = [System.Drawing.Bitmap]::FromFile("$env:userprofile\desktop\Generador QR\Archivos\Logo tanque.jpg") [System.Windows.Forms.Clipboard]::SetImage($logo) $richtextbox1.Paste() $logo.Dispose() $richtextbox1.SelectionFont = New-Object System.Drawing.Font("arial", 8, [System.Drawing.Fontstyle]::Regular) $richtextbox1.AppendText("`nText") $richtextbox1.SelectionFont = New-Object System.Drawing.Font("arial", 18,[System.Drawing.Fontstyle]::Bold) $richtextbox1.AppendText("`n`nText2")
- Edited by D.M.L Thursday, April 11, 2019 2:29 PM
Thursday, April 11, 2019 2:18 PM -
It's working now, did not do anything, just test it again and it works :PThursday, April 11, 2019 2:48 PM
-
You have to be sure the selection point is at the end or where you want it. If the I age is selected after the paste then the next assignment will replace the image.
\_(ツ)_/
- Marked as answer by D.M.L Thursday, April 11, 2019 3:40 PM
Thursday, April 11, 2019 2:54 PM