PDA

View Full Version : رنگ کردن به قسمت اضافه شده در RichTextBox



مهیار.
سه شنبه 19 آبان 1394, 00:19 صبح
با سلام خدمت دوستان

چرا کد رو برو جواب نمیده ..

public static void AppendText(this RichTextBox box, string text, Color color) {
int s, e;
s = box.TextLength;
e = text.Length;
box.AppendText(text);
box.SelectionStart = s;
box.SelectionLength =e;
box.SelectionFont = new Font("Consolas", 10, FontStyle.Regular);
box.SelectionColor = color;
box.SelectionColor = box.ForeColor;
}

aminmousavi
سه شنبه 19 آبان 1394, 02:51 صبح
سلام دوست عزیز .

public static void AppendText(this RichTextBox box, string text, Color color)
{
int s, e;
s = box.TextLength;
e = text.Length;
box.AppendText(text);
box.SelectionStart = s;
box.SelectionLength = e;
box.SelectionFont = new Font("Consolas", 10, FontStyle.Regular);
box.SelectionColor = color;
}