本文整理汇总了C#中TextSource.CreateLine方法的典型用法代码示例。如果您正苦于以下问题:C# TextSource.CreateLine方法的具体用法?C# TextSource.CreateLine怎么用?C# TextSource.CreateLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextSource
的用法示例。
在下文中一共展示了TextSource.CreateLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BreakLines
internal static void BreakLines(int iLine, int pos, TextSource ts)
{
Line newLine = ts.CreateLine();
for(int i=pos;i<ts[iLine].Count;i++)
newLine.Add(ts[iLine][i]);
ts[iLine].RemoveRange(pos, ts[iLine].Count - pos);
//
ts.InsertLine(iLine+1, newLine);
}
示例2: InsertLine
internal static void InsertLine(TextSource ts)
{
var tb = ts.CurrentTB;
if (!tb.Multiline && tb.LinesCount > 0)
return;
if (ts.Count == 0)
ts.InsertLine(0, ts.CreateLine());
else
BreakLines(tb.Selection.Start.iLine, tb.Selection.Start.iChar, ts);
tb.Selection.Start = new Place(0, tb.Selection.Start.iLine + 1);
ts.NeedRecalc(new TextSource.TextChangedEventArgs(0, 1));
}
示例3: BreakLines
/// <summary>
/// Chop an existing line into two lines.
/// This means that this method is also called when pressing enter on the start of a line.
/// </summary>
/// <param name="iLine"></param>
/// <param name="pos"></param>
/// <param name="ts"></param>
internal static void BreakLines(int iLine, int pos, TextSource ts)
{
Line newLine = ts.CreateLine();
EolFormat format = EolFormat.None;
if (iLine < ts.Count - 1)
{
// breaking in the middle of an existing line
format = ts[iLine].EolFormat;
}
newLine.EolFormat = format;
for (int i = pos; i < ts[iLine].Count; i++)
newLine.Add(ts[iLine][i]);
ts[iLine].RemoveRange(pos, ts[iLine].Count - pos);
//
ts.InsertLine(iLine + 1, newLine);
}