Пример #1
0
        protected override void PaintElementSkin(Telerik.WinControls.Paint.IGraphics graphics)
        {
            base.PaintElementSkin(graphics);
            if ((this.Parent as RadScrollBarElement).ScrollType == ScrollType.Horizontal)
            {
                VisualStyles.VisualStyleElement gripperGlyph = VisualStyles.VisualStyleElement.ScrollBar.GripperHorizontal.Normal;

                if (SystemSkinManager.Instance.SetCurrentElement(gripperGlyph))
                {
                    Graphics  g  = (Graphics)graphics.UnderlayGraphics;
                    Size      sz = SystemSkinManager.Instance.GetPartPreferredSize(g, this.Bounds, System.Windows.Forms.VisualStyles.ThemeSizeType.True);
                    Point     gripperLocation = new Point((int)(this.ControlBoundingRectangle.Width - sz.Width) / 2, (int)(this.ControlBoundingRectangle.Height - sz.Height) / 2);
                    Rectangle arrowRect       = new Rectangle(gripperLocation, sz);
                    SystemSkinManager.Instance.PaintCurrentElement(g, arrowRect);
                }
            }
            else
            {
                VisualStyles.VisualStyleElement gripperGlyph = VisualStyles.VisualStyleElement.ScrollBar.GripperVertical.Normal;

                if (SystemSkinManager.Instance.SetCurrentElement(gripperGlyph))
                {
                    Graphics  g  = (Graphics)graphics.UnderlayGraphics;
                    Size      sz = SystemSkinManager.Instance.GetPartPreferredSize(g, this.Bounds, System.Windows.Forms.VisualStyles.ThemeSizeType.True);
                    Point     gripperLocation = new Point((int)(this.ControlBoundingRectangle.Width - sz.Width) / 2, (int)(this.ControlBoundingRectangle.Height - sz.Height) / 2);
                    Rectangle arrowRect       = new Rectangle(gripperLocation, sz);
                    SystemSkinManager.Instance.PaintCurrentElement(g, arrowRect);
                }
            }
        }
Пример #2
0
        protected override void PaintElementSkin(Telerik.WinControls.Paint.IGraphics graphics)
        {
            if (object.ReferenceEquals(SystemSkinManager.DefaultElement, SystemSkinManager.Instance.CurrentElement))
            {
                return;
            }

            base.PaintElementSkin(graphics);
        }
Пример #3
0
        /// <summary>
        /// This method paints the left RibbonTab shadow that appears on the right of the tab.
        /// The method paints two 1 pixel wide vertical linear gradient lines that
        /// create a shadow effect. The colors of the shadow can be styled by
        /// the Visual Style Builder.
        /// </summary>
        private void PaintLeftTabShadow(Telerik.WinControls.Paint.IGraphics graphics)
        {
            int          shapeCausedOffset = 3;
            int          shadowLineWidth   = 1;
            GraphicsPath shadowPath1       = new GraphicsPath();

            Rectangle shadowBounds1 = new Rectangle(
                shapeCausedOffset - shadowLineWidth,
                shapeCausedOffset + 1,
                shadowLineWidth,
                this.Bounds.Height - shapeCausedOffset);

            shadowPath1.AddLine(
                shapeCausedOffset - shadowLineWidth,
                shapeCausedOffset + 1,
                shapeCausedOffset - shadowLineWidth,
                this.Bounds.Height - shapeCausedOffset);

            graphics.DrawLinearGradientPath(shadowPath1,
                                            shadowBounds1,
                                            new Color[] {
                this.LeftShadowInnerColor1,
                this.LeftShadowInnerColor2
            },
                                            PenAlignment.Left,
                                            shadowLineWidth,
                                            90);


            GraphicsPath shadowPath2   = new GraphicsPath();
            Rectangle    shadowBounds2 = new Rectangle(
                shapeCausedOffset - 2 * shadowLineWidth,
                shapeCausedOffset + 1,
                shadowLineWidth,
                this.Bounds.Height - shapeCausedOffset);

            shadowPath2.AddLine(
                shapeCausedOffset - 2 * shadowLineWidth,
                shapeCausedOffset + 1,
                shapeCausedOffset - 2 * shadowLineWidth,
                this.Bounds.Height - shapeCausedOffset);

            graphics.DrawLinearGradientPath(shadowPath2,
                                            shadowBounds2,
                                            new Color[] {
                this.LeftShadowOuterColor1,
                this.LeftShadowOuterColor2
            },
                                            PenAlignment.Left,
                                            shadowLineWidth,
                                            90);
        }
Пример #4
0
        protected override void PaintElement(Telerik.WinControls.Paint.IGraphics graphics, float angle, SizeF scale)
        {
            object state = graphics.SaveState();

            Graphics g = (graphics.UnderlayGraphics as Graphics);

            Rectangle rect = new Rectangle(0, 0, this.Bounds.Width, this.Bounds.Height);

            g.SetClip(this.Shape.CreatePath(rect), System.Drawing.Drawing2D.CombineMode.Intersect);

            base.PaintElement(graphics, angle, scale);

            graphics.RestoreState(state);
        }
Пример #5
0
        public void PaintPrimitive(Telerik.WinControls.Paint.IGraphics graphics, float angle, System.Drawing.SizeF scale, TextParams textParams)
        {
            if (this.isDirty)
            {
                this.isDirty   = false;
                this.TextBlock = TinyHTMLParsers.Parse(textParams);
            }

            RectangleF   paintingRectangle = textParams.paintingRectangle;
            StringFormat format            = textParams.CreateStringFormat();

            this.TextBlock.PaintFormatTextBlock(graphics, paintingRectangle, true, format, TextFormatFlags.Default, textParams.textWrap, textParams.ClipText);
            format.Dispose();
        }
Пример #6
0
        protected override void PaintElement(Telerik.WinControls.Paint.IGraphics graphics, float angle, SizeF scale)
        {
            if (this.owner == null)
            {
                this.owner = base.Owner as RibbonTabStripElement;
            }
            if (this.owner.PaintTabShadows)
            {
                this.PaintRightTabShadow(graphics);
                this.PaintLeftTabShadow(graphics);
            }

            base.PaintElement(graphics, angle, scale);
        }
Пример #7
0
        protected override void PaintElement(Telerik.WinControls.Paint.IGraphics graphics, float angle, SizeF scale)
        {
            base.PaintElement(graphics, angle, scale);

            if (IsCurrent)
            {
                Graphics g = (Graphics)graphics.UnderlayGraphics;
                using (Pen pen = new Pen(Color.Black))
                {
                    Rectangle rect = new Rectangle(-1, -1, this.Size.Width + 1, this.Size.Height + 1);
                    pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                    g.DrawRectangle(pen, rect);
                }
            }
        }
Пример #8
0
        protected override void PaintElement(Telerik.WinControls.Paint.IGraphics graphics, float angle, SizeF scale)
        {
            RadRibbonBar parentRibbon = this.ElementTree.Control as RadRibbonBar;

            if (parentRibbon != null)
            {
                if (parentRibbon.CompositionEnabled && !this.IsDesignMode &&
                    this.TabItems.Count > 0 && this.ControlBoundingRectangle.Size != Size.Empty)
                {
                    if (this.captionText.Visibility == ElementVisibility.Visible)
                    {
                        this.captionText.SetDefaultValueOverride(RadElement.VisibilityProperty, ElementVisibility.Hidden);
                    }

                    Color foreColor = Color.Black;

                    Form parentForm = parentRibbon.FindForm();

                    if (parentForm != null &&
                        parentForm.WindowState == FormWindowState.Maximized)
                    {
                        foreColor = Color.White;
                    }

                    GraphicsPath graphicsPath = new GraphicsPath();

                    graphicsPath.AddString(
                        this.captionText.Text,
                        this.Font.FontFamily,
                        (int)this.Font.Style,
                        (this.Font.Size / 72) * 96,
                        this.captionText.BoundingRectangle,
                        this.captionText.CreateStringFormat());
                    graphics.FillPath(foreColor, graphicsPath);
                }
            }
            else
            {
                if (this.captionText.Visibility == ElementVisibility.Hidden)
                {
                    this.captionText.SetDefaultValueOverride(RadElement.VisibilityProperty, ElementVisibility.Visible);
                }
            }
        }
        //Logic for painting the elements
        protected override void PaintElement(Telerik.WinControls.Paint.IGraphics graphics, float angle, System.Drawing.SizeF scale)
        {
            base.PaintElement(graphics, angle, scale);

            Rectangle clipRect = this.Bounds;
            Graphics  g        = graphics.UnderlayGraphics as Graphics;

            g.SetClip(clipRect);

            DateTime currentDate = this.TimelineBehavior.AdjustedTimelineStart;

            while (currentDate <= this.TimelineBehavior.AdjustedTimelineEnd)
            {
                float x = (float)((currentDate - this.TimelineBehavior.AdjustedTimelineStart).TotalSeconds / this.OnePixelTime.TotalSeconds);
                x -= this.HorizontalScrollBarElement.Value;
                float y  = this.GanttViewElement.HeaderHeight;
                float y2 = this.Bounds.Height;

                if (currentDate.DayOfWeek == DayOfWeek.Saturday || currentDate.DayOfWeek == DayOfWeek.Sunday)
                {
                    graphics.FillRectangle(new RectangleF(x, y, 100f, y2), Color.LightGray);
                }
                else if (this.SpecialDates.Contains(currentDate.Date))
                {
                    graphics.FillRectangle(new RectangleF(x, y, 100f, y2), Color.Orange);
                }
                else
                {
                    graphics.FillRectangle(new RectangleF(x, y, 100f, y2), Color.White);
                }

                graphics.DrawLine(Color.LightBlue, x, y, x, y2);

                currentDate = currentDate.AddDays(1);
            }

            g.ResetClip();
        }
Пример #10
0
        protected override void PaintOverride(Telerik.WinControls.Paint.IGraphics screenRadGraphics, Rectangle clipRectangle, float angle, SizeF scale, bool useRelativeTransformation)
        {
            if (this.LeftImage != null && this.RightImage != null && this.MiddleImage != null)
            {
                using (Graphics g = screenRadGraphics.UnderlayGraphics as Graphics)
                {
                    using (Brush brush = new SolidBrush(Color.FromArgb(255, this.BackColor)))
                    {
                        g.FillRectangle(brush, this.BoundingRectangle);
                    }

                    int imageMaxHeight = this.MiddleImage.Height;
                    int rightWidth     = this.Size.Width - this.rightImage.Width;

                    Rectangle tileRect = new Rectangle(
                        this.leftImage.Width,
                        0,
                        this.Size.Width - this.leftImage.Width - this.rightImage.Width,
                        imageMaxHeight);

                    Rectangle clipRect = Rectangle.Intersect(this.BoundingRectangle, tileRect);

                    ImageLayout imgLayout = ImageLayout.Tile;
                    if (ElementTree != null)
                    {
                        imgLayout = this.ElementTree.Control.BackgroundImageLayout;
                    }

                    DrawBackgroundImage(g, this.MiddleImage, BackColor, imgLayout, tileRect, clipRect, Point.Empty, this.RightToLeft);

                    g.DrawImage(this.rightImage, new Point(rightWidth, 0));
                    g.DrawImage(this.leftImage, Point.Empty);
                }
            }

            base.PaintOverride(screenRadGraphics, clipRectangle, angle, scale, useRelativeTransformation);
        }
Пример #11
0
        public override void PaintPrimitive(Telerik.WinControls.Paint.IGraphics g, float angle, System.Drawing.SizeF scale)
        {
            RadRibbonBar ribbonBar = this.ElementTree.Control as RadRibbonBar;

            if (ribbonBar != null)
            {
                RadFormControlBase form = ribbonBar.FindForm() as RadFormControlBase;

                if (form != null && form.FormBehavior is RadRibbonFormBehavior)
                {
                    float scaleAmount     = form.Width / (float)ribbonBar.Width;
                    int   translateAmount = (form.Width - ribbonBar.Width) / 2;
                    g.TranslateTransform(-translateAmount, 0);

                    if (scaleAmount != 0f && !float.IsInfinity(scaleAmount))
                    {
                        g.ScaleTransform(new SizeF(scaleAmount, 1));
                    }

                    base.PaintPrimitive(g, angle, scale);

                    g.TranslateTransform(translateAmount, 0);

                    scaleAmount = ribbonBar.Width / (float)form.Width;

                    if (scaleAmount != 0f && !float.IsInfinity(scaleAmount))
                    {
                        g.ScaleTransform(new SizeF(scaleAmount, 1));
                    }
                }
                else
                {
                    base.PaintPrimitive(g, angle, scale);
                }
            }
        }
Пример #12
0
 public void PaintPrimitive(Telerik.WinControls.Paint.IGraphics graphics, TextParams textParams)
 {
     this.PaintPrimitive(graphics, 0f, scalingSize, textParams);
 }