Exemplo n.º 1
0
            protected override void OnPaint(PaintEventArgs e)
            {
                base.OnPaint(e);

                if (UIStyleUtils.IsOffice2007Scheme(Config.UIStyle))
                {
                    // draw shadow around page
                    ShadowPaintInfo pi = new ShadowPaintInfo();
                    pi.Graphics  = e.Graphics;
                    pi.Rectangle = FContent.Bounds;
                    pi.Size      = 6;
                    ShadowPainter.Paint2(pi);
                }
            }
Exemplo n.º 2
0
        private void DrawPages(Graphics g)
        {
            if (Disabled)
            {
                return;
            }

            // draw visible pages
            int firstVisible = PreviewPages.FindFirstVisiblePage(Offset.Y);
            int lastVisible  = PreviewPages.FindLastVisiblePage(Offset.Y + ClientSize.Height);

            for (int i = firstVisible; i <= lastVisible; i++)
            {
                Rectangle pageBounds = PreviewPages.GetPageBounds(i);
                pageBounds.Offset(-Offset.X, -Offset.Y);
                ReportPage page = PreparedPages.GetCachedPage(i);

                // draw shadow around page
                ShadowPaintInfo pi = new ShadowPaintInfo();
                pi.Graphics  = g;
                pi.Rectangle = new Rectangle(pageBounds.Left - 4, pageBounds.Top - 4, pageBounds.Width + 4, pageBounds.Height + 4);
                pi.Size      = 5;
                ShadowPainter.Paint2(pi);

                // shift the origin because page.Draw draws at 0, 0
                g.TranslateTransform((int)pageBounds.Left, (int)pageBounds.Top);
                FRPaintEventArgs e = new FRPaintEventArgs(g, Zoom, Zoom, GraphicCache);
                // draw page
                page.Draw(e);

                // draw search highlight
                if (SearchInfo != null && SearchInfo.Visible && SearchInfo.PageNo == i + 1)
                {
                    page.DrawSearchHighlight(e, SearchInfo.ObjNo, SearchInfo.Ranges[SearchInfo.RangeNo]);
                }
                g.ResetTransform();

                // draw border around active page
                if (i == PageNo - 1)
                {
                    Pen borderPen = GraphicCache.GetPen(Preview.ActivePageBorderColor, 2, DashStyle.Solid);
                    pageBounds.Inflate(-1, -1);
                    g.DrawRectangle(borderPen, pageBounds);
                }
            }
        }
Exemplo n.º 3
0
        protected override void PaintStateBackground(ButtonItem button, Graphics g, Office2007ButtonItemStateColorTable stateColors, Rectangle r, IShapeDescriptor shape, bool isDefault, bool paintBorder)
        {
            if (stateColors == null || stateColors.Background == null || stateColors.Background.IsEmpty)
                return;

            Rectangle shadowRect = r;
            ShadowPaintInfo spi = new ShadowPaintInfo();
            spi.Graphics = g;
            spi.Rectangle = shadowRect;
            ShadowPainter.Paint3(spi);

            r.Width -= 4;
            r.Height -= 4;
            r.Offset(1, 1);

            DisplayHelp.FillRectangle(g, r, stateColors.Background);
            if (stateColors.BottomBackgroundHighlight != null && !stateColors.BottomBackgroundHighlight.IsEmpty)
            {
                Rectangle ellipse = new Rectangle(r.X, r.Y + r.Height / 2 - 2, r.Width, r.Height + 4);
                GraphicsPath path = new GraphicsPath();
                path.AddEllipse(ellipse);
                PathGradientBrush brush = new PathGradientBrush(path);
                brush.CenterColor = stateColors.BottomBackgroundHighlight.Start;
                brush.SurroundColors = new Color[] { stateColors.BottomBackgroundHighlight.End };
                brush.CenterPoint = new PointF(ellipse.X + ellipse.Width / 2, r.Bottom);
                Blend blend = new Blend();
                blend.Factors = new float[] { 0f, .5f, .6f };
                blend.Positions = new float[] { .0f, .4f, 1f };
                brush.Blend = blend;

                g.FillRectangle(brush, r);
                brush.Dispose();
                path.Dispose();
            }

            DisplayHelp.DrawGradientRectangle(g, r, stateColors.OuterBorder, 1);
            r.Inflate(-1, -1);
            DisplayHelp.DrawGradientRectangle(g, r, stateColors.InnerBorder, 1);
        }
Exemplo n.º 4
0
        protected override void PaintInnerContent(System.Windows.Forms.PaintEventArgs e, ElementStyle style, bool paintText)
        {
            base.PaintInnerContent(e, style, paintText);

            if (!m_IsShadowEnabled) return;
            Graphics g = e.Graphics;
            ShadowPaintInfo pi = new ShadowPaintInfo();
            pi.Graphics = g;
            pi.Size = 6;
            foreach (Control c in this.Controls)
            {
                if (!c.Visible || c.BackColor == Color.Transparent && !(c is GroupPanel)) continue;
                if (c is GroupPanel)
                {
                    GroupPanel p = c as GroupPanel;
                    pi.Rectangle = new Rectangle(c.Bounds.X, c.Bounds.Y + p.GetInternalClientRectangle().Y/2, c.Bounds.Width, c.Bounds.Height - p.GetInternalClientRectangle().Y/2);
                }
                else
                    pi.Rectangle = c.Bounds;
                ShadowPainter.Paint2(pi);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Paints insides of the control.
        /// </summary>
        /// <param name="e">Paint event arguments.</param>
        protected override void PaintInnerContent(PaintEventArgs e, ElementStyle style, bool paintText)
        {
            Graphics g = e.Graphics;
            if (this.TextMarkupElement == null)
                RefreshTextClientRectangle();
            Rectangle r = this.DisplayRectangle;
#if FRAMEWORK20
            r.X -= this.Padding.Left;
            r.Y -= this.Padding.Top;
            r.Width += this.Padding.Horizontal;
            r.Height += this.Padding.Vertical;
#else
            r.X -= this.DockPadding.Left;
            r.Y -= this.DockPadding.Top;
            r.Width += this.DockPadding.Left + this.DockPadding.Right;
            r.Height += this.DockPadding.Top + this.DockPadding.Bottom;
#endif
            r.Inflate(2, 2);
            ElementStyleDisplayInfo info = new ElementStyleDisplayInfo(style, g, r);
            info.RightToLeft = (this.RightToLeft == RightToLeft.Yes);
            ElementStyleDisplay.PaintBackground(info, false);
            if (style.BackgroundImage != null) ElementStyleDisplay.PaintBackgroundImage(info);
            if (!m_IsShadowEnabled) return;
            ShadowPaintInfo pi = new ShadowPaintInfo();
            pi.Graphics = g;
            pi.Size = 6;
            foreach (Control c in this.Controls)
            {
                if (!c.Visible || c.BackColor == Color.Transparent && !(c is GroupPanel)) continue;
                if (c is GroupPanel)
                {
                    GroupPanel p = c as GroupPanel;
                    pi.Rectangle = new Rectangle(c.Bounds.X, c.Bounds.Y + p.GetInternalClientRectangle().Y / 2, c.Bounds.Width, c.Bounds.Height - p.GetInternalClientRectangle().Y / 2);
                }
                else
                    pi.Rectangle = c.Bounds;
                ShadowPainter.Paint2(pi);
            }
        }