/// <summary>
        /// Updates the find all results panel
        /// </summary>
        /// <param name="FindReplace">The FindReplace instance used to generate the find results.</param>
        /// <param name="FindAllResults"></param>
        public void UpdateFindAllResults(FindReplace FindReplace, List <ScintillaNET_FindReplaceDialog.CharacterRange> FindAllResults)
        {
            if (Scintilla == null)
            {
                return;
            }

            _findAllResults = new List <ScintillaNET_FindReplaceDialog.CharacterRange>(FindAllResults);

            FindResultsScintilla.ClearAll();

            Indicator _indicator = FindResultsScintilla.Indicators[16];

            _indicator.ForeColor = Color.Red;
            _indicator.Alpha     = 100;
            _indicator.Style     = IndicatorStyle.RoundBox;
            _indicator.Under     = true;

            FindResultsScintilla.IndicatorCurrent = _indicator.Index;

            //Write lines
            foreach (var item in _findAllResults)
            {
                int startLine = Scintilla.LineFromPosition(item.cpMin);
                int endLine   = Scintilla.LineFromPosition(item.cpMax);

                if (startLine == endLine)
                {
                    string resultsLinePrefix = string.Format("Line {0}: ", startLine + 1);

                    FindResultsScintilla.AppendText(string.Format("{0}{1}",
                                                                  resultsLinePrefix, Scintilla.Lines[startLine].Text));
                }
            }

            //Highlight
            int resultLineIndex = 0;

            foreach (var item in _findAllResults)
            {
                int startLine = Scintilla.LineFromPosition(item.cpMin);
                int endLine   = Scintilla.LineFromPosition(item.cpMax);

                if (startLine == endLine)
                {
                    string resultsLinePrefix = string.Format("Line {0}: ", startLine + 1);

                    int LinePos        = Scintilla.Lines[startLine].Position;
                    int startPosInLine = item.cpMin - LinePos;

                    int lastLineStartPos = FindResultsScintilla.Lines[resultLineIndex].Position;

                    FindResultsScintilla.IndicatorFillRange(lastLineStartPos + resultsLinePrefix.Length + startPosInLine, item.cpMax - item.cpMin);

                    resultLineIndex++;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates a new instance of FindAllResultsPanel
        /// </summary>
        public FindAllResultsPanel()
        {
            InitializeComponent();

            FindResultsScintilla.Styles[Style.Default].Font = "Consolas";
            FindResultsScintilla.Styles[Style.Default].Size = 10;

            FindResultsScintilla.ClearAll();
        }