Table of Contents

Class Selection

Namespace
Alternet.Editor
Assembly
Alternet.Editor.v9.dll

Represents class used to manage selected part of the Edit control's text content.

public class Selection : ISelection, IDisposable
Inheritance
Selection
Implements

Constructors

Selection()

Initializes a new instance of the Selection class with default settings.

Selection(ISyntaxEdit)

Initializes a new instance of the Selection class with a specified owner.

Fields

MaxChangesCount

Properties

AllowedSelectionMode

Gets or sets type of selection allowed to Edit control content.

BackColor

Gets or sets a background color of the SelectedText when owner control has input focus.

BorderColor

Gets or sets a color of the selection border.

ForeColor

Gets or sets a foreground color of the SelectedText when owner control has input focus.

InActiveBackColor

Gets or sets a background color of the SelectedText when owner control does not have input focus.

InActiveForeColor

Gets or sets a foreground color of the SelectedText when owner control does not have input focus.

IsEmpty

Indicates whether nothing is selected.

KeyHandlers
Options

Gets or sets options determining behaviour or the Selection.

Owner
SelEnd
SelStart
SelectedColorData

Gets or sets strings that corresponds to selected part of the control's text content.

SelectedText

Gets or sets strings that corresponds to selected part of the control's text content.

SelectedWordsBackColor

Gets or sets a background color used to fill highlighted selected word area.

SelectionLength

Gets or sets length of the SelectedText.

SelectionRect

Gets or sets rectangular area indicating selected text of the control.

SelectionStart

Gets or sets the position of the first selected character while text considered as a single string.

SelectionState

Gets or sets a value indicates state of the selected text.

SelectionType

Gets or sets type of current selection. SelectionType

UpdateCount

Keeps track of calls to BeginUpdate and EndUpdate so that they can be nested.

Methods

ApplyTextChanges(IList<ITextUndo>, bool)

Applies text changes to the text.

Assign(ISelection)

Copies the contents from another ISelection object.

BeginUpdate()

Prevents the Selection updating until the EndUpdate method is called. EndUpdate()

CanCommentSelection(string, string)
CanCopy()

Indicates whether selected text can be copied to the clipboard.

CanCut()

Indicates whether selected text can be cut to the clipboard.

CanDelete()

Indicates whether selected text can be deleted.

CanDrag(Point)

Indicates whether the control can drag selected text.

CanPaste()

Indicates whether the control can paste some text from the clipboard.

CanSelectBlock()
CanUncommentSelection(string, string)
Capitalize()

Changes first character of all words in selected text to upper-case and all another characters to lower-case.

ChangeBlock(StringEvent)

Changes selected text by applying specified event to every line in the selected text.

ChangeBlock(StringEvent, bool, bool)

Changes selected text by applying specified event to every line in the selected text.

ChangeBlock(TextUndoEvent)

Changes selected text by applying specified event to every line in the selected text.

ChangeBlock(TextUndoEvent, TextUndoEventEx, bool, bool)
ChangeBlock(TextUndoEvent, bool, bool)

Changes selected text by applying specified event to every line in the selected text.

CharTransponse()

Transposes character under the caret with the next character.

Clear()

Makes selection empty, without deleting its content.

CollapseToDefinitions()

Collapses and expands some outline section to get a quick overall view of the Edit content.

CommentSelection()

Marks the selected text as a comment, using the correct comment syntax for the programming language.

Copy()

Copies SelectedText to the Clipboard.

Cut()

Cuts SelectedText to the Clipboard.

CutLine()

Cuts current line to the clipboard if no text selected; otherwise cuts selected text.

Delete()

Deletes selected text from the control.

Delete(ExtendedSelectionScope)

When implemented by a class, deletes selected text from the control.

DeleteLeft()

Deletes one character left to the cursor.

DeleteLeft(bool)
DeleteLine()

Deletes current line if no text selected; otherwise deletes selected text.

DeleteRight()

Deletes one character right to the cursor.

DeleteRight(bool)
DeleteWhiteSpace()

Removes all space and tab characters from selected text. If nothing is selected the method removes space and tab characters from the current line.

DeleteWordLeft()

Deletes one word left to the cursor.

DeleteWordRight()

Deletes one word right to the cursor.

Dispose()

Disposes this Selection and frees resources associated with it.

Dispose(bool)
DragScroll(Point)
DragTo(Point, bool)

Moves or copies selected text to the specified position.

EndSelection()

Stops selection.

EndUpdate()

Re-enables selection updating turned off by calling BeginUpdate method. BeginUpdate()

~Selection()

Destroys the instance of the Selection class.

GetDataObject()
GetSearchSelectionForLine(int, out int, out int)

Sets left and right parameter to the first and last selected characters within specified line, when edit control is in search selection mode.

GetSelectedBounds(int, IList<IRange>)
GetSelectedText(bool)
GetSelectionForLine(int, out int, out int)

Sets left and right index of the first and last selected characters within specified line.

GetSelectionForLine(int, out int, out int, bool)
GetSelectionForLine(int, out int, out int, bool, SelectionType, Rectangle)
GetSelectionRegion(SelectionType, Rectangle)
HighlightSelectedWords()
Indent()

Indents the selected text by one indentation level, inserting Tab or spaces to the beginning of the line.

InsertString(string)

Inserts given text to the control's content deleting selected text if needed.

Invalidate()

Invalidates a selection region of the editor control and causes a paint message to be sent to the editor control.

Invalidate(SelectionType, Rectangle)

Invalidates a selection region of the editor control and causes a paint message to be sent to the editor control.

Selection type. Selection rectangle.
IsBlockEmpty(SelectionType, Rectangle)
IsPosInSelection(Point)

Indicates whether given position located within the selected region.

IsPosInSelection(int, int)

Indicates whether given position located within the selected region.

IsPosInSelection(int, int, bool)
IsSelectionRectEmpty()
IsSelectionRectEmpty(SelectionType, Rectangle)
IsSelectionRectEmpty(Rectangle)
IsValidSelectionPoint(Point)

Indicates whether specified position located at the top-left or right-bottom corners of selection area.

IsWholeWordSelected()
LineTransponse()

Transposes line under the caret with the next line.

LowerCase()

Converts all selected characters to the lower-case.

Modified()

Responds on any modifications in the editor.

Move(Point, bool)

Moves or copies selected text to the specified position.

MoveSelectionDown()

Moves selected text to the following line in the control.

MoveSelectionUp()

Moves selected text to the preceding line in the control.

NeedDragScroll(Point)
NewLine()

Inserts a line break at the current position of the control.

NewLineAbove()

Inserts a line break above the current position of the control.

NewLineBelow()

Inserts a line break below the current position of the control.

OnAfterPaste()

Raises AfterPaste event.

OnAllowedSelectionModeChanged()
OnBackColorChanged()
OnBeforePaste(ref string, ref SelectionType)

Raises BeforePaste event.

OnBorderColorChanged()
OnForeColorChanged()
OnInActiveBackColorChanged()
OnInActiveForeColorChanged()
OnOptionsChanged()
OnSelect(object, EventArgs)

Selects part of text source settings. Reserved for internal use.

OnSelectedWordsBackColorChanged()
OnSelectionChanged()

Raises SelectionChanged event.

OnSelectionStateChanged()
Paste()

Pastes the content of the Clipboard to the Edit control, replacing selected text if needed.

Paste(string, SelectionType)
PositionChanged(int, int, int, int)

Responds on changing position in the editor.

ProcessEscape()

Processes escape pressure: method deselects selected text.

ProcessShiftTab()

Moves current position to the previous tab stop if the selected text is empty; otherwise unindents selected text.

ProcessTab()

Inserts new tab character or spaces if the selected text is empty; otherwise indents selected text.

ResetAllowedSelectionMode()

Resets the AllowedSelectionMode to the default value.

ResetBackColor()

Resets the BackColor to the default value.

ResetBorderColor()

Resets the BorderColor to the default value.

ResetForeColor()

Resets the ForeColor to the default value.

ResetInActiveBackColor()

Resets the InActiveBackColor to the default value.

ResetInActiveForeColor()

Resets the InActiveForeColor to the default value.

ResetOptions()

Resets the Options to the default value.

ResetSelectedWordColor()

Resets the SelectedWordsColor to the default value.

RestoreSelection(ITextSource, SelectionType, int, int, int)
ScrollIfNeeded(Point)

Scrolls to specified position if needed.

SelectAll()

Selects all lines in the control's content.

SelectCharLeft()

Increases selected text to one character at the left side of the selection region.

SelectCharLeft(SelectionType)

Increases selected text to one character at the left side of the selection region and sets a given selection type.

SelectCharRight()

Increases selected text to one character at the right side of the selection region.

SelectCharRight(SelectionType)

Increases selected text to one character at the right side of the selection region and sets a given selection type.

SelectCurrentWord()

Tries to select word nearest to the current position in the control.

SelectFileBegin()

Increases selected text to beginning of the control's content.

SelectFileBegin(SelectionType)

Increases selected text to beginning of the control's content and sets a given selection type.

SelectFileEnd()

Increases selected text to end of the control's content.

SelectFileEnd(SelectionType)

Increases selected text to end of the control's content and sets a given selection type.

SelectLine()

Selects entire line at the current position in the control.

SelectLineBegin()

Selects from current position to the beginning of current line in the control.

SelectLineBegin(SelectionType)

Selects from current position to the beginning of current line in the control and sets a given selection type.

SelectLineDown()

Increases selected text to the following line in the control.

SelectLineDown(SelectionType)

Increases selected text to the following line in the control and sets a given selection type.

SelectLineEnd()

Selects from current position to the end of current line in the control.

SelectLineEnd(SelectionType)

Selects from current position to the end of current line in the control and sets a given selection type.

SelectLineOnTrippleClick()

Selects entire line at the current position in the control as a result of triple click.

SelectLineUp()

Increases selected text to the preceding line in the control.

SelectLineUp(SelectionType)

Increases selected text to the preceding line in the control and sets a given selection type.

SelectNextWord()

Select word next to the current word.

SelectPageDown()

Increases selected text to the one page down in the control.

SelectPageDown(SelectionType)

Increases selected text to the one page down in the control and sets a given selection type.

SelectPageUp()

Increases selected text to the one page up in the control.

SelectPageUp(SelectionType)

Increases selected text to the one page up in the control and sets a given selection type.

SelectScreenBottom()

Increases selected text to the end of screen.

SelectScreenBottom(SelectionType)

Increases selected text to the end of the screen and sets a given selection type.

SelectScreenTop()

Increases selected text to the begin of screen.

SelectScreenTop(SelectionType)

Increases selected text to the begin of the screen and sets a given selection type.

SelectToBrace()

Increases selected text to the next open or closing brace.

SelectToCloseBrace()

Increases selected text to the next closing brace.

SelectToOpenBrace()

Increases selected text to the prev open brace.

SelectWord()

Selects a word at the current position in the control.

SelectWordLeft()

Increases selected text to the word located at the left side of the current position in the control.

SelectWordLeft(SelectionType)

Increases selected text to the word located at the left side of the current position in the control and sets a given selection type.

SelectWordRight()

Increases selected text to the word located at the right side of the current position in the control.

SelectWordRight(SelectionType)

Increases selected text to the word located at the right side of the current position in the control and sets a given selection type.

SelectedCount()

Returns amount of the lines being selected.

SelectedData(int)

Returns selected part of color information at specified position.

SelectedString(int)

Returns selected part of string at specified position.

SelectedString(int, SelectionType, Rectangle)
SelectionToScreen()

Represents selection region in a screen coordinates.

SelectionToTextPoint(Point)

Converts given selection coordinate to the text coordinate.

SetSelectedText(string, SelectionType)

Replaces SelectedText by specified text.

SetSelectedText(string, SelectionType, bool)

Replaces SelectedText by specified text.

SetSelection(SelectionType, Point, Point)

Sets new selection region with specified selection type.

SetSelection(SelectionType, Rectangle)

Sets new selection region with specified selection type.

ShouldDelete()
ShouldDeleteBlock()
ShouldSerializeAllowedSelectionMode()

Indicates whether the AllowedSelectionMode property should be persisted.

ShouldSerializeBackColor()

Indicates whether the BackColor property should be persisted.

ShouldSerializeBorderColor()

Indicates whether the BorderColor property should be persisted.

ShouldSerializeForeColor()

Indicates whether the FontColor property should be persisted.

ShouldSerializeInActiveBackColor()

Indicates whether the InActiveBackColor property should be persisted.

ShouldSerializeInActiveForeColor()

Indicates whether the InActiveForeColor property should be persisted.

ShouldSerializeOptions()

Indicates whether the Options property should be persisted.

ShouldSerializeSelectedWordsBackColor()

Indicates whether the SelectedWordsBackColor property should be persisted.

SmartFormat()

Formats selected text using indentation obtained from Syntax Parser supporting Alternet.Syntax.SyntaxOptions.SmartIndent.

SmartFormat(bool, bool, bool, bool, bool, int)
SmartFormat(char)

Formats given line using indentation obtained from Syntax Parser supporting Alternet.Syntax.SyntaxOptions.SmartIndent.

Specifies Character being typed
SmartFormat(int)

Formats given line using indentation obtained from Syntax Parser supporting Alternet.Syntax.SyntaxOptions.SmartIndent.

SmartFormatBlock(bool, char)

Formats current syntax block using indentation obtained from Syntax Parser supporting Alternet.Syntax.SyntaxOptions.SmartIndent.

SmartFormatDocument()

Formats entire document using indentation obtained from Syntax Parser supporting Alternet.Syntax.SyntaxOptions.SmartIndent.

SmartIndent()

Positions the cursor to the line indentation level, obtained from parser supporting Alternet.Syntax.SyntaxOptions.SmartIndent option when user presses Enter.

SmartIndent(char)

Formats given current line using indentation obtained from Syntax Parser supporting Alternet.Syntax.SyntaxOptions.SmartIndent.

Specifies character being typed
SmartSetSelectedText(string, SelectionType)
StartSelection()

Forces selection start.

StoreSelection(ITextSource, out SelectionType, out int, out int, out int)
SwapAnchor()

Change current position from beginning of selection rectangle to the end of selection rectangle or vice versa.

Tabify()

Converts spaces to tabs in the current string within the selected area according to tab settings.

TextToSelectionPoint(Point)

Converts given text coordinate to the selection coordinate.

ToggleOutlining()

Toggles expanded state for all IOutlineRange objects in outline collection.

ToggleOverWrite()

Toggles the control's overwrite mode.

UnHighlightSelectedWords()
UnIndent()

Unindents the selected text by one indentation level, deleting Tab or spaces from the beginning of the line.

UnTabify()

Converts tabs to spaces in the current string within the selected area according to tab settings.

UncommentSelection()

Removes the comment syntax from the selected text.

UndoOperations(IList<ITextUndo>, bool)
UndoOperations(int, ITextUndoList, bool)
UpdateSelRange(Point, Point)

Updates selection start and end to the specified position.

UpdateSelRect(ref SelectionType, SelectionType, ref Rectangle, Rectangle, ref bool)
UpdateSelStart(bool)

Updates selection start to the specified position.

UpdateSelStart(Point)

Updates selection start to the specified position.

UpdateSelStart(Point, bool)
UpdateSelection()

Invalidates selected region.

UpperCase()

Converts all selected characters to the upper-case.

WordTransponse()

Transposes word under the caret with the next word.

WriteToClipboard(bool)

Events

AfterPaste

Occurs when text is already pasted.

BeforePaste

Occurs when text is about to be pasted.

SelectionChanged

Occurs when selection bounds are changed.