Insert paragraph between richtextbox text and change font and color of added paragraph
my text is in richtextbox:
<Parag1 Level="One"> First text of parag1. Second text of parag1. </Parag1> <Parag2 Level="Two"> First text of parag2. Second text of parag2. </Parag2> <Parag3 Level="Footer"> First text of parag3. Second text of parag3. </Parag3> <Parag4 Level="Three"> First text of parag4. Second text of parag4. </Parag4>
Font of all tags with level One, Two, Three - Arial, Size = 9, Color = Red Example: <Parag1 Level="One">
Or </Parag4>
The font of the text between tags with levels One, Two, Three - MicrosoftNewRomans, Size = 12, Color = Black Example: First text of parag2. Second text of parag2.
First text of parag2. Second text of parag2.
Text font between tags with footer level - Tahoma, Size = 10, Color = Blue Example: First text of parag3. Second text of parag3.
First text of parag3. Second text of parag3.
I want to add this paragraph between tags 3 and 4. For example:
<NewParag5 Level="Footer"> This tags between 3 and 4. </NewParag5>
Question: How can I do this with the same font and color for a separate part of the paragraph. this means that without changing the font and color of my other text, I can insert a paragraph in the richtextbox, and then for the tags change the font or color to red so that the text changes to blue.
Please help me in C # and winforms richtextbox.
Thank x.
Question 2: How to add a paragraph between the text, this font and the color of the paragraph parts are set font style tags and styles to save the text back (font and color).
I would try this approach: RadioButton
.
If you add several of them to your solution, you can check if the entered text, paragraph, etc. are entered.
eg.
if(tagRadioButton.Checked) { //Colors , Fonts Selection logic. }
If you do not want to use any switches, you can search for an imputed string for keywords and change colors and fonts depending on what is imputed. I'm sure you can find a good tutorial, but because I'm not very good at string manipulations.
Hope this helps.