本文整理汇总了C#中Mono.TextEditor.TextEditorData.ExtendSelectionTo方法的典型用法代码示例。如果您正苦于以下问题:C# TextEditorData.ExtendSelectionTo方法的具体用法?C# TextEditorData.ExtendSelectionTo怎么用?C# TextEditorData.ExtendSelectionTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.TextEditor.TextEditorData
的用法示例。
在下文中一共展示了TextEditorData.ExtendSelectionTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EndLineSelection
public static void EndLineSelection (TextEditorData data)
{
int fromLine = data.MainSelection.Anchor.Line;
int toLine = data.Caret.Line;
var toSegment = data.Document.GetLine (toLine);
//flip the anchor if pivoting around the origin line
if (fromLine == toLine + 1) {
if ((fromLine - data.MainSelection.Lead.Line) != 2) {
var fromSegment = data.Document.GetLine (fromLine);
data.SetSelection (fromSegment.EndOffset, toSegment.Offset);
} else {
data.SetSelection (toSegment.Offset, toSegment.EndOffset);
}
}
//else just extend the selection
else {
int toOffset = (toLine < fromLine)? toSegment.Offset: toSegment.EndOffset;
data.ExtendSelectionTo (toOffset);
}
data.Caret.PreserveSelection = false;
}
示例2: EndSelection
public static void EndSelection (TextEditorData data)
{
data.ExtendSelectionTo (data.Caret.Location);
data.Caret.AutoScrollToCaret = true;
data.Caret.PreserveSelection = false;
}
示例3: EndLineSelection
public static void EndLineSelection (TextEditorData data)
{
int fromLine = data.MainSelection.Anchor.Line,
toLine = data.Caret.Line;
LineSegment toSegment = data.Document.GetLine (toLine);
int toOffset = (toLine < fromLine)? toSegment.Offset: toSegment.EndOffset;
data.ExtendSelectionTo (toOffset);
data.Caret.PreserveSelection = false;
}