public SetSelection ( ISelection selection ) : void | ||
selection | ISelection | |
return | void |
public void SetSelection(ISelection selection)
{
// autoClearSelection = false;
if (selection != null) {
if (SelectionCollection.Count == 1 &&
selection.StartPosition == SelectionCollection[0].StartPosition &&
selection.EndPosition == SelectionCollection[0].EndPosition ) {
return;
}
ClearWithoutUpdate();
selectionCollection.Add(selection);
document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, selection.StartPosition.Y, selection.EndPosition.Y));
document.CommitUpdate();
OnSelectionChanged(EventArgs.Empty);
} else {
ClearSelection();
}
}
SelectionManager::SetSelection ( Point startPosition, Point endPosition ) : void |
/// <summary> /// Selects the specified text range. /// </summary> static void SelectText(SelectionManager selectionManager, IDocument document, int startOffset, int length) { selectionManager.ClearSelection(); TextLocation selectionStart = document.OffsetToPosition(startOffset); TextLocation selectionEnd = document.OffsetToPosition(startOffset + length); selectionManager.SetSelection(selectionStart, selectionEnd); }