예제 #1
0
파일: ToolHelper.cs 프로젝트: sw0/RegexTool
        public static void TextBoxSelectionChanged(TextBoxBase textbox, Action <RowColumnIndex> notificationAct)
        {
            if (null == textbox)
            {
                return;
            }

            var line   = textbox.GetLineFromCharIndex(textbox.SelectionStart);
            var column = textbox.SelectionStart - textbox.GetFirstCharIndexOfCurrentLine();

            //Debug.WriteLine("Line: {0}, Column: {1}", line, column);

            RowColumnIndex rci = new RowColumnIndex()
            {
                Row             = line + 1,
                Column          = column + 1,
                SelectionLength = textbox.SelectionLength,
                Length          = textbox.TextLength,
            };

            if (notificationAct != null)
            {
                notificationAct(rci);
            }
        }