Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

AvalonEdit: How to get linenumbers and column mnumbers?

$
0
0

I have an application which uses WPF RichTextBox and I have the following code which updates the linenumber and column as the mouse is moved inside the RichTextBox. Now inorder to get the same functionality with AvalonEdit is there a solution?

ICSharpCode.AvalonEdit.TextEditor newEditor = new ICSharpCode.AvalonEdit.TextEditor();

newEditor.ShowLineNumbers = true;

//RichTextBox code which updates linenumber and column:

 private void UpdateLineNumberColumn()

       {

            if (rtbList[EditorTabcontrol.SelectedIndex] != null)

            {               

                /*TextPointer tp1 = rtbList[EditorTabcontrol.SelectedIndex].Selection.Start.GetLineStartPosition(0);

                TextPointer tp2 = rtbList[EditorTabcontrol.SelectedIndex].Selection.Start;

 

                int currentColumnNumber = tp1.GetOffsetToPosition(tp2);

 

                int someBigNumber = int.MaxValue;

                int lineMoved, currentLineNumber;

                rtbList[EditorTabcontrol.SelectedIndex].Selection.Start.GetLineStartPosition(-someBigNumber, out lineMoved);

                currentLineNumber = -lineMoved;

                if (currentLineNumber != 0)

                    currentColumnNumber += 1;

 

                segFileList[EditorTabcontrol.SelectedIndex].LnCol = "Ln" + (currentLineNumber+1).ToString() + " Col" + (currentColumnNumber).ToString();*/

            }            

        }       


Viewing all articles
Browse latest Browse all 1764

Trending Articles