【发布时间】:2011-10-17 18:51:58
【问题描述】:
我在 RichTextBox 中写作。
如何使 lineItems 和 j+1 变量以红色打印。
例如(粗体=红色):元素Growthougth在第4列,没有写对。
private void button2_Click(object sender, EventArgs e)
{
// Numbers-IDs
if (colB[j] == "int_number")
{
if (!arithmos(lineItems[j]))
richTextBox1.Text += "Element " + lineItems[j] + "\t in " + (j + 1) + "th coloumn,has not been writen right" + Environment.NewLine;
}
// Alphanumeric
else if (colB[j] == "alpharithmitiko")
{
if (!numword(lineItems[j]))
richTextBox1.Text += "Element " + lineItems[j] + " in " + (j + 1) + "th coloumn,has not been writen right " + Environment.NewLine;
}
//Words
else if (colB[j] == "words")
{
if (!word(lineItems[j]))
richTextBox1.Text += "Το στοιχείο " + lineItems[j] + " in " + (j + 1) + "th coloumn,has not been writen right" + Environment.NewLine;
}
//Date
else if (colB[j] == "date")
{
if (!date(lineItems[j]))
richTextBox1.Text += "Το στοιχείο " + lineItems[j] + " in " + (j+1) + "th coloumn,has not been writen right" + Environment.NewLine;
}
}
【问题讨论】:
-
@Reniuz 看看我的编辑
-
更改文本前景色不起作用?
-
用户“sehe”for this question的回答对你来说是同样的解决方案。
-
您使用的是 WPF 还是 Winforms?
标签: c# richtextbox