コード例 #1
0
        protected void AddRangeBracket(AnnotationMarkerLayoutBox marker)
        {
            Color bracketColor = GetBracketColor();

            Point           topPoint;
            Point           bottomPoint;
            InlineLayoutBox inlineBox = marker;

            if (marker.AssociatedAnnotationMarker is AnnotationRangeStart)
            {
                inlineBox = (InlineLayoutBox)DocumentStructureCollection.GetNextSiblingForDocumentElement(marker, null);

                topPoint = new Point(
                    inlineBox.ControlBoundingRectangle.Left,
                    inlineBox.ControlBoundingRectangle.Top - (inlineBox.LineInfo.BaselineOffset - inlineBox.BaselineOffset));

                bottomPoint = new Point(topPoint.X, topPoint.Y + inlineBox.LineInfo.Height);
            }
            else
            {
                inlineBox = (InlineLayoutBox)DocumentStructureCollection.GetPreviousSiblingForDocumentElement(marker, null);

                topPoint = new Point(
                    inlineBox.ControlBoundingRectangle.Right,
                    inlineBox.ControlBoundingRectangle.Top - (inlineBox.LineInfo.BaselineOffset - inlineBox.BaselineOffset));

                bottomPoint = new Point(topPoint.X, topPoint.Y + inlineBox.LineInfo.Height);
            }


            Polyline polyline = new Polyline();

            Canvas.SetZIndex(polyline, 5);
            polyline.Stroke          = new SolidColorBrush(bracketColor);
            polyline.StrokeThickness = 1;
            if (marker.AssociatedAnnotationMarker is AnnotationRangeStart)
            {
                polyline.Points.Add(new Point(topPoint.X + 2, topPoint.Y));
                polyline.Points.Add(topPoint);
                polyline.Points.Add(bottomPoint);
                polyline.Points.Add(new Point(bottomPoint.X + 2, bottomPoint.Y));
            }
            else
            {
                polyline.Points.Add(new Point(topPoint.X - 2, topPoint.Y));
                polyline.Points.Add(topPoint);
                polyline.Points.Add(bottomPoint);
                polyline.Points.Add(new Point(bottomPoint.X - 2, bottomPoint.Y));
            }

            base.AddDecorationElement(polyline);
        }
コード例 #2
0
        protected void AddRangeBracket(AnnotationMarkerLayoutBox marker)
        {
            Color bracketColor = GetBracketColor();

            Point topPoint;
            Point bottomPoint;
            InlineLayoutBox inlineBox = marker;
            if (marker.AssociatedAnnotationMarker is AnnotationRangeStart)
            {
                inlineBox = (InlineLayoutBox)DocumentStructureCollection.GetNextSiblingForDocumentElement(marker, null);

                topPoint = new Point(
                    inlineBox.ControlBoundingRectangle.Left,
                    inlineBox.ControlBoundingRectangle.Top - (inlineBox.LineInfo.BaselineOffset - inlineBox.BaselineOffset));

                bottomPoint = new Point(topPoint.X, topPoint.Y + inlineBox.LineInfo.Height);
            }
            else
            {
                inlineBox = (InlineLayoutBox)DocumentStructureCollection.GetPreviousSiblingForDocumentElement(marker, null);

                topPoint = new Point(
                    inlineBox.ControlBoundingRectangle.Right,
                    inlineBox.ControlBoundingRectangle.Top - (inlineBox.LineInfo.BaselineOffset - inlineBox.BaselineOffset));

                bottomPoint = new Point(topPoint.X, topPoint.Y + inlineBox.LineInfo.Height);
            }


            Polyline polyline = new Polyline();
            Canvas.SetZIndex(polyline, 5);
            polyline.Stroke = new SolidColorBrush(bracketColor);
            polyline.StrokeThickness = 1;
            if (marker.AssociatedAnnotationMarker is AnnotationRangeStart)
            {
                polyline.Points.Add(new Point(topPoint.X + 2, topPoint.Y));
                polyline.Points.Add(topPoint);
                polyline.Points.Add(bottomPoint);
                polyline.Points.Add(new Point(bottomPoint.X + 2, bottomPoint.Y));
            }
            else
            {
                polyline.Points.Add(new Point(topPoint.X - 2, topPoint.Y));
                polyline.Points.Add(topPoint);
                polyline.Points.Add(bottomPoint);
                polyline.Points.Add(new Point(bottomPoint.X - 2, bottomPoint.Y));
            }

            base.AddDecorationElement(polyline);
        }
コード例 #3
0
 private static bool AnnotationBoxFilter(AnnotationMarkerLayoutBox annotationMarkerBox)
 {
     return (annotationMarkerBox.AssociatedAnnotationMarker is CustomRangeStart || annotationMarkerBox.AssociatedAnnotationMarker is CustomRangeEnd);
 }
コード例 #4
0
 private static bool AnnotationBoxFilter(AnnotationMarkerLayoutBox annotationMarkerBox)
 {
     return(annotationMarkerBox.AssociatedAnnotationMarker is CustomRangeStart || annotationMarkerBox.AssociatedAnnotationMarker is CustomRangeEnd);
 }