Exemplo n.º 1
0
        /// <summary>
        /// Draws the content of a <see cref="T:System.Windows.Media.DrawingContext"/> object during the render pass of a <see cref="T:System.Windows.Controls.Panel"/> element.
        /// </summary>
        /// <param name="dc">The <see cref="T:System.Windows.Media.DrawingContext"/> object to draw.</param>
        protected override void OnRender(DrawingContext dc)
        {
            base.OnRender(dc);

            var scale = 1d;
            if (_mustScale) scale = _scale.ScaleX;

            var offset = new Point();
            if (_scrollHorizontal.Visibility == Visibility.Visible) offset.X += (_scrollHorizontal.Value * _scale.ScaleX) * -1;
            if (_scrollVertical.Visibility == Visibility.Visible) offset.Y += (_scrollVertical.Value * _scale.ScaleY) * -1;

            if (_headers.Count != 0)
            {
                if (GroupHeaderRenderer == null) GroupHeaderRenderer = new AutoLayoutHeaderRenderer();

                foreach (var bg in _groupBackgrounds)
                    GroupHeaderRenderer.RenderBackground(dc, bg, scale, offset);

                foreach (var header in _headers)
                    GroupHeaderRenderer.RenderHeader(dc, header, scale, offset);
            }

            if (RenderHorizontalControlSeparatorLines && HorizontalLineSeparatorBrush != null)
            {
                var pen = new Pen(HorizontalLineSeparatorBrush, 1d);
                foreach (var column in _controlPairPositionedRectangles)
                {
                    var right = column.Max(c => c.Right);
                    right = (double)(int) right;
                    foreach (var rect in column)
                    {
                        var y = rect.Bottom + VerticalControlSeparatorOffset;
                        y = (int) y;
                        y += .5d;
                        var x = (double) (int) rect.X;
                        dc.DrawLine(pen, new Point(x, y), new Point(right, y));
                    }
                }
            }

            OnRenderCustom(dc, scale, offset);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Draws the content of a <see cref="T:System.Windows.Media.DrawingContext"/> object during the render pass of a <see cref="T:System.Windows.Controls.Panel"/> element.
        /// </summary>
        /// <param name="dc">The <see cref="T:System.Windows.Media.DrawingContext"/> object to draw.</param>
        protected override void OnRender(DrawingContext dc)
        {
            base.OnRender(dc);

            if (!RenderHeaders) return;

            if (HeaderRenderer == null) HeaderRenderer = new AutoLayoutHeaderRenderer();

            var offset = new Point();

            foreach (var header in _headers)
                HeaderRenderer.RenderHeader(dc, header, 1d, offset);
        }