❔ Problems with applying multiple styles on text in RichTextBox

Im trying to apply some styles to a piece of text in a richTextBox and they just won't work properly. Here is an example: "BeamMP Description". I want to make the last 2 characters of the word "BeamMP" bold (MP) and the second word bold and underlined. So for the first word i do this: I set the selectionStart to 0 and the selectionLength to the end of the RTBox. Then this: RTBox.SelectionFont = new Font(RTBox.SelectionFont, RTBox.SelectionFont.Style | FontStyle.Bold); Similar way to underline the word "Description" But the problem here is that the bolding magically dissapears and only the underline at the word Description is applied???
9 Replies
Zerium
Zerium2y ago
Here you go RTBox.Select(5,18); RTBox.SelectionFont = new Font(RTBox.SelectionFont, RTBox.SelectionFont.Style | FontStyle.Bold); RTBox.Select(7, 18); RTBox.SelectionFont = new Font(RTBox.SelectionFont, RTBox.SelectionFont.Style | FontStyle.Underline);
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Diesel Geezer
Diesel GeezerOP2y ago
Still doesn't work properly
Zerium
Zerium2y ago
does it use winforms .net framework .net 6 or not winforms entirely
Diesel Geezer
Diesel GeezerOP2y ago
winforms net framework
Zerium
Zerium17mo ago
i few more questions one is when you say it does not work does that mean the the end text is no longer bold and just underlined and 2 is, is RTBox just the name of the richtextbox or are you using some sort of gui add on for winforms
Accord
Accord17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Diesel Geezer
Diesel GeezerOP17mo ago
yes, the text is no longer bold and yes, RTBox is just the name of the richtextbox
Accord
Accord17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server