RichTextBox does not setFont/Color properly

  • Thread starter Thread starter BadButBit
  • Start date Start date
B

BadButBit

Guest
I have a richTextBox that I'm passing by reference to a function along with a filename. This function reads the text in the file and sets the text in the RichTextBox to the appropriate fonts for the given parcels of text. But it sets the entire RichTextBox to the first settings and then no matter how many parts of the RichTextBox's text is set to other various fonts and colors the only one that is visible is the first one. Here's an example :

int intSelection_Start = rtx.Text.Length;
int intSelection_Length = xHeading.InnerText.Length;
rtx.Text += xHeading.InnerText;
rtx.Select(intSelection_Start, intSelection_Length);
rtx.SelectionFont = fntBold;
rtx.SelectionColor = Color.Blue;

rtx.Text += "\r\n";
intSelection_Start = rtx.Text.Length;
intSelection_Length = xAlt_heading.InnerText.Length;
rtx.Text += xAlt_heading.InnerText;
rtx.Select(intSelection_Start, intSelection_Length);
rtx.SelectionFont = fnt;
rtx.SelectionColor = Color.Black;


the first setting of 'bold' & Blue is the only setting for the entire RichTextBox... ?

BadButBit


my code is perfect until i don't find a bug

Continue reading...
 
Back
Top