コード例 #1
0
        private static void MakePair(
            HtmlParser.HtmlParser.Word prev,
            string nextValue,
            ICollection <HtmlParser.HtmlParser.Word> allWords)
        {
            var next = allWords.FirstOrDefault(word => word.Index == prev.Index + 1 && word.Value == nextValue);

            if (next.Equals(default(HtmlParser.HtmlParser.Word)))
            {
                allWords.Remove(prev);
                return;
            }

            var newWord = new HtmlParser.HtmlParser.Word
            {
                Index       = next.Index,
                LeftUp      = prev.LeftUp,
                RightBottom = next.RightBottom,
                Value       = prev.Value + " " + next.Value
            };

            allWords.Remove(prev);
            allWords.Remove(next);
            allWords.Add(newWord);
        }
コード例 #2
0
        internal void HighlightWord(HtmlParser.HtmlParser.Word word)
        {
            int x1             = (int)(word.LeftUp.X / _coefficient);
            int y1             = (int)(word.LeftUp.Y / _coefficient);
            int x2             = (int)(word.RightBottom.X / _coefficient);
            int y2             = (int)(word.RightBottom.Y / _coefficient);
            var hoverRectangle = new Rectangle(x1, y1, x2 - x1 + Eps, y2 - y1 + Eps);

            _graphics.DrawRectangle(_rectanglePen, hoverRectangle);
        }