本文整理匯總了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;
}