当前位置: 首页>>代码示例>>C#>>正文


C# TextSource.RemoveLine方法代码示例

本文整理汇总了C#中TextSource.RemoveLine方法的典型用法代码示例。如果您正苦于以下问题:C# TextSource.RemoveLine方法的具体用法?C# TextSource.RemoveLine怎么用?C# TextSource.RemoveLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextSource的用法示例。


在下文中一共展示了TextSource.RemoveLine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClearSelected

        internal static void ClearSelected(TextSource ts)
        {
            var tb = ts.CurrentTB;

            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)
                ts[fromLine].RemoveRange(fromChar, toChar - fromChar);
            else
            {
                ts[fromLine].RemoveRange(fromChar, ts[fromLine].Count - fromChar);
                ts[toLine].RemoveRange(0, toChar);
                ts.RemoveLine(fromLine + 1, toLine - fromLine - 1);
                InsertCharCommand.MergeLines(fromLine, ts);
            }
            //
            tb.Selection.Start = new Place(fromChar, fromLine);
            //
            ts.NeedRecalc(new TextSource.TextChangedEventArgs(fromLine, toLine));
        }
开发者ID:brunoviske,项目名称:CogEngine,代码行数:26,代码来源:Commands.cs

示例2: MergeLines

        /// <summary>
        /// Merge lines i and i+1
        /// </summary>
        internal static void MergeLines(int i, TextSource ts)
        {
            var tb = ts.CurrentTB;

            if (i + 1 >= ts.Count)
                return;
            tb.ExpandBlock(i);
            tb.ExpandBlock(i + 1);
            int pos = ts[i].Count;

            // save the next lines EolFormat, because this one is the one that is saved
            EolFormat format = ts[i + 1].EolFormat;
            //
            /*
            if(ts[i].Count == 0)
                ts.RemoveLine(i);
            else*/
            if (ts[i + 1].Count == 0)
            {
                ts.RemoveLine(i + 1);
            }
            else
            {
                ts[i].AddRange(ts[i + 1]);
                ts.RemoveLine(i + 1);
            }
            // set the EolFormat to the next lines EolFormat.
            ts[i].EolFormat = format;

            tb.Selection.Start = new Place(pos, i);
            ts.NeedRecalc(new TextSource.TextSourceTextChangedEventArgs(0, 1));
        }
开发者ID:rickaas,项目名称:FastColoredTextBox,代码行数:35,代码来源:InsertCharCommand.cs

示例3: MergeLines

        /// <summary>
        /// Merge lines i and i+1
        /// </summary>
        internal static void MergeLines(int i, TextSource ts)
        {
            var tb = ts.CurrentTB;

            if (i + 1 >= ts.Count)
                return;
            tb.ExpandBlock(i);
            tb.ExpandBlock(i + 1);
            int pos = ts[i].Count;
            //
            if(ts[i].Count == 0)
                ts.RemoveLine(i);
            else
            if (ts[i + 1].Count == 0)
                ts.RemoveLine(i + 1);
            else
            {
                ts[i].AddRange(ts[i + 1]);
                ts.RemoveLine(i + 1);
            }
            tb.Selection.Start = new Place(pos, i);
            ts.NeedRecalc(new TextSource.TextChangedEventArgs(0, 1));
        }
开发者ID:brunoviske,项目名称:CogEngine,代码行数:26,代码来源:Commands.cs

示例4: ClearSelected

        internal static void ClearSelected(TextSource ts)
        {
            var tb = ts.CurrentTb;

            tb.Selection.Normalize();

            var start = tb.Selection.Start;
            var end = tb.Selection.End;
            var fromLine = Math.Min(end.ILine, start.ILine);
            var toLine = Math.Max(end.ILine, start.ILine);
            var fromChar = tb.Selection.FromX;
            var toChar = tb.Selection.ToX;
            if (fromLine < 0) return;
            //
            if (fromLine == toLine)
                ts[fromLine].RemoveRange(fromChar, toChar - fromChar);
            else
            {
                ts[fromLine].RemoveRange(fromChar, ts[fromLine].Count - fromChar);
                ts[toLine].RemoveRange(0, toChar);
                ts.RemoveLine(fromLine + 1, toLine - fromLine - 1);
                InsertCharCommand.MergeLines(fromLine, ts);
            }
        }
开发者ID:workwhileweb,项目名称:FastColoredTextBox,代码行数:24,代码来源:Commands.cs


注:本文中的TextSource.RemoveLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。