public void CleanHighlight(int line) { if (OutputTextBox.InvokeRequired) { CleanHighlightCallback d = new CleanHighlightCallback(CleanHighlight); OutputTextBox.BeginInvoke(d, new object[] { line }); } else { int oldSelStart = OutputTextBox.SelectionStart; int oldSelLen = OutputTextBox.SelectionLength; OutputTextBox.Select(OutputTextBox.GetFirstCharIndexFromLine(line), OutputTextBox.Lines[line].Length); OutputTextBox.SelectionBackColor = OutputTextBox.BackColor; OutputTextBox.SelectionColor = OutputTextBox.ForeColor; OutputTextBox.Select(oldSelStart, oldSelLen); } }
public void HighlightLine(int line, Color BKColor, Color TextColor) { if (OutputTextBox.InvokeRequired) { HighlightLineCallback d = new HighlightLineCallback(HighlightLine); OutputTextBox.BeginInvoke(d, new object[] { line, BKColor, TextColor }); } else { int oldSelStart = OutputTextBox.SelectionStart; int oldSelLen = OutputTextBox.SelectionLength; OutputTextBox.Select(OutputTextBox.GetFirstCharIndexFromLine(line), OutputTextBox.Lines[line].Length); OutputTextBox.SelectionBackColor = BKColor; OutputTextBox.SelectionColor = TextColor; OutputTextBox.Select(oldSelStart, oldSelLen); LastHighlitedLine = line; } }