本文整理汇总了C#中FastColoredTextBox.RemoveLine方法的典型用法代码示例。如果您正苦于以下问题:C# FastColoredTextBox.RemoveLine方法的具体用法?C# FastColoredTextBox.RemoveLine怎么用?C# FastColoredTextBox.RemoveLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FastColoredTextBox
的用法示例。
在下文中一共展示了FastColoredTextBox.RemoveLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearSelected
internal static void ClearSelected(FastColoredTextBox tb)
{
Place start = tb.Selection.Start;
Place end = tb.Selection.End;
int fromLine = Math.Min(end.iLine, start.iLine);
int toLine = Math.Max(end.iLine, start.iLine);
int fromChar = tb.Selection.FromX;
int toChar = tb.Selection.ToX;
if (fromLine < 0) return;
//
if (fromLine == toLine)
tb[fromLine].RemoveRange(fromChar, toChar - fromChar);
else
{
tb[fromLine].RemoveRange(fromChar, tb[fromLine].Count - fromChar);
tb[toLine].RemoveRange(0, toChar);
tb.RemoveLine(fromLine + 1, toLine - fromLine - 1);
InsertCharCommand.MergeLines(fromLine, tb);
}
//
tb.Selection.Start = new Place(fromChar, fromLine);
//
tb.needRecalc = true;
}
示例2: MergeLines
/// <summary>
/// Merge lines i and i+1
/// </summary>
internal static void MergeLines(int i, FastColoredTextBox tb)
{
if (i + 1 >= tb.LinesCount)
return;
tb.ExpandBlock(i);
tb.ExpandBlock(i + 1);
int pos = tb[i].Count;
//
if(tb[i].Count == 0)
tb.RemoveLine(i);
else
if (tb[i + 1].Count == 0)
tb.RemoveLine(i + 1);
else
{
tb[i].AddRange(tb[i + 1]);
tb.RemoveLine(i + 1);
}
tb.Selection.Start = new Place(pos, i);
tb.needRecalc = true;
}