Click to See Complete Forum and Search --> : Rtb @ C#
RPG2KILL
April 6th, 2003, 01:23 PM
when i change text color at RTB by SelectionColor, i see the selection flickering.
how can prevent the RTB from updating view, until i finish coloring?
underwar
April 7th, 2003, 07:05 AM
what are you trying to do?
give us more details about what you're doing.
RPG2KILL
April 10th, 2003, 10:00 AM
My question:
Is there another way to color text on rich text box, without using SelectionColor(,)?
Coloring text with SelectionColor() is not good enough, because its take too much time, and i see the text selected and unselected.
I have lot of text to color and it take many seconds till it finish.
pareshgh
April 10th, 2003, 12:33 PM
you may try out,
richTextBox1.Focus();
richTextBox1.SelectionColor = Color.Red;
richTextBox1.SelectionFont = new Font ("Courier", 10, FontStyle.Bold);
pareshgh
April 10th, 2003, 12:33 PM
try
{
int start = richTextBox1.SelectionStart;
int len = richTextBox1.SelectionLength;
System.Drawing.Font currentFont;
FontStyle fs;
for(int i = 0; i < len; ++i)
{
richTextBox1.Select(start + i, 1);
currentFont = richTextBox1.SelectionFont;
fs = currentFont.Style;
//add style
fs = fs | style;
richTextBox1.SelectionFont = new Font(
currentFont.FontFamily,
currentFont.Size,
fs
);
}
}
private void RemoveFontStyle(FontStyle style)
{
int start = richTextBox1.SelectionStart;
int len = richTextBox1.SelectionLength;
System.Drawing.Font currentFont;
FontStyle fs;
for(int i = 0; i < len; ++i)
{
richTextBox1.Select(start + i, 1);
currentFont = richTextBox1.SelectionFont;
fs = currentFont.Style;
//remove style
fs = fs & ~style;
richTextBox1.SelectionFont = new Font(
currentFont.FontFamily,
currentFont.Size,
fs
);
}
}
private void button1_Click(object sender, System.EventArgs e)
{
AddFontStyle(FontStyle.Bold);
}
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.