I want to change the font in a specific line. Here's my code...
string[] textBoxLines = richTextBox1.Lines;
foreach (string line in textBoxLines)
{
if(line.StartsWith("-->"))
{
//here is my problem, how to can change the font in the spectific line...
}
}
string[] textBoxLines = richTextBox1.Lines;
for (int i = 0; i < textBoxLines.Length; i++)
{
string line = textBoxLines[i];
if (line.StartsWith("-->"))
{
richTextBox1.SelectionStart = richTextBox1.GetFirstCharIndexFromLine(i);
richTextBox1.SelectionLength = line.Length;
richTextBox1.SelectionFont = yourFont;
}
}
richTextBox1.SelectionLength = 0;//Unselect the selection
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.