Example #1
0
        protected override void PaintElement(Telerik.WinControls.Paint.IGraphics graphics, float angle, SizeF scale)
        {
            base.PaintElement(graphics, angle, scale);

            PointF[] points = new PointF[4];
            points[0] = new PointF(this.loadingElement.BoundingRectangle.X, this.Size.Height - 1);
            points[1] = new PointF(this.loadingElement.BoundingRectangle.Right, this.Size.Height * 0.35f);
            points[2] = new PointF(this.unloadingElement.BoundingRectangle.X, this.Size.Height * 0.35f);
            points[3] = new PointF(this.unloadingElement.BoundingRectangle.Right, this.Size.Height - 1);

            graphics.ChangeSmoothingMode(System.Drawing.Drawing2D.SmoothingMode.AntiAlias);
            graphics.FillPolygon(Color.FromArgb(100, Color.Gray), points);
            graphics.RestoreSmoothingMode();
        }
        public override void PaintPrimitive(Telerik.WinControls.Paint.IGraphics graphics, float angle, SizeF scale)
        {
            base.PaintPrimitive(graphics, angle, scale);

            if (this.Size.Height == 0 || this.Size.Width == 0)
            {
                return;
            }

            Rectangle innerBorderRect = new Rectangle(
                new Point(OUTER_BORDER_WIDTH, OUTER_BORDER_WIDTH),
                Size.Subtract(this.Size, new Size(OUTER_BORDER_WIDTH * 2, OUTER_BORDER_WIDTH * 2)));


            this.PaintInnerBorder(graphics, innerBorderRect, this.BorderColor1);
            this.PaintTitleBarExtensions(graphics);

            Rectangle outerBorderRect = new Rectangle(Point.Empty, Size.Subtract(this.Size, new Size(1, 1)));

            this.PaintOuterBorder(graphics, outerBorderRect, this.BorderColor);

            this.PaintClientAreaShadow(graphics, this.ShadowColor);
        }
Example #3
0
        /// <summary>Draws the primitive on the screen.</summary>
        public override void PaintPrimitive(Telerik.WinControls.Paint.IGraphics g, float angle, SizeF scale)
        {
            if (this.Parent == null)
            {
                return;
            }

            this.SetSize();
            if (this.width <= 0 || this.height <= 0)
            {
                return;
            }

            int colorsMaxValue = 4;

            Color[] colorStops   = new Color[Math.Min(Math.Max(this.NumberOfColors, 1), colorsMaxValue)];
            float[] colorOffsets = new float[Math.Min(Math.Max(this.NumberOfColors, 1), colorsMaxValue)];

            if (this.NumberOfColors > 0)
            {
                colorStops[0]   = BackColor;
                colorOffsets[0] = 0f;
            }

            if (this.NumberOfColors > 1)
            {
                colorStops[1] = BackColor2;
                colorOffsets[colorStops.Length - 1] = 1f;
            }

            if (this.NumberOfColors > 2)
            {
                colorStops[2]   = BackColor3;
                colorOffsets[1] = this.GradientPercentage;
            }

            if (this.NumberOfColors > 3)
            {
                colorStops[3]   = BackColor4;
                colorOffsets[2] = this.GradientPercentage2;
            }

            Rectangle rect = new Rectangle(Point.Empty, this.Size);

            int delta            = Math.Max(1, this.Maximum - this.Minimum);
            int fillWidth        = (int)Math.Round(((float)this.width * Value1) / delta);
            int fillHeight       = (int)Math.Round(((float)this.height * Value1) / delta);
            int fillWidthValue2  = (int)Math.Round(((float)this.width * Value2) / delta);
            int fillHeightValue2 = (int)Math.Round(((float)this.height * Value2) / delta);

            int sepCount = (int)Math.Ceiling((double)fillWidth / ProgressBarPrimitive.DefaultSeparatorWidth);

            Rectangle chunkbar       = new Rectangle(0, 0, fillWidth, height);
            Rectangle chunkBarValue2 = new Rectangle(0, 0, fillWidthValue2, height);

            // FILL the progress area
            switch (Orientation)
            {
            case ProgressOrientation.Top:
            {
                chunkbar       = new Rectangle(0, 0, this.width, fillHeight);
                chunkBarValue2 = new Rectangle(0, 0, this.width, fillHeightValue2);

                break;
            }

            case ProgressOrientation.Right:
            {
                chunkbar       = new Rectangle(this.width - fillWidth, 0, fillWidth, this.height);
                chunkBarValue2 = new Rectangle(this.width - fillWidthValue2, 0, fillWidthValue2, this.height);

                break;
            }

            case ProgressOrientation.Bottom:
            {
                chunkbar       = new Rectangle(0, height - fillHeight, this.width, fillHeight);
                chunkBarValue2 = new Rectangle(0, height - fillHeightValue2, this.width, fillHeightValue2);

                break;
            }
            }

            this.progressRect = chunkbar;
            if (this.HasImage)
            {
                return;
            }

            switch (GradientStyle)
            {
            case GradientStyles.Solid:
                g.FillRectangle(chunkBarValue2, Color.FromArgb(25, BackColor));
                g.FillRectangle(chunkbar, BackColor);
                break;

            case GradientStyles.Glass:
                g.FillRectangle(chunkBarValue2, Color.FromArgb(25, BackColor));
                g.FillGlassRectangle(chunkbar, BackColor, BackColor2, BackColor3, BackColor4, this.GradientPercentage, this.GradientPercentage2);
                break;

            case GradientStyles.OfficeGlass:
                g.FillRectangle(chunkBarValue2, Color.FromArgb(25, BackColor));
                g.FillOfficeGlassRectangle(chunkbar, BackColor, BackColor2, BackColor3, BackColor4, this.GradientPercentage, this.GradientPercentage2, true);
                break;

            case GradientStyles.OfficeGlassRect:
                g.FillRectangle(chunkBarValue2, Color.FromArgb(25, BackColor));
                g.FillOfficeGlassRectangle(chunkbar, BackColor, BackColor2, BackColor3, BackColor4, this.GradientPercentage, this.GradientPercentage2, false);
                break;

            case GradientStyles.Vista:
                g.FillRectangle(chunkBarValue2, Color.FromArgb(25, BackColor));
                g.FillVistaRectangle(chunkbar, BackColor, BackColor2, BackColor3, BackColor4, this.GradientPercentage, this.GradientPercentage2);
                break;

            case GradientStyles.Gel:
                g.FillRectangle(chunkBarValue2, Color.FromArgb(25, BackColor));
                g.FillGellRectangle(chunkbar, colorStops, this.GradientPercentage, this.GradientPercentage2);
                break;

            case GradientStyles.Radial:
            case GradientStyles.Linear:
                g.FillRectangle(chunkBarValue2, Color.FromArgb(25, BackColor));
                g.FillGradientRectangle(chunkbar, colorStops, colorOffsets, base.GradientStyle, GradientAngle, this.GradientPercentage, this.GradientPercentage2);
                break;
            }
            if (Dash)
            {
                DrawLines(g, fillWidth, fillHeight, fillWidthValue2, fillHeightValue2);
            }
        }
Example #4
0
        protected override void PaintImage(Telerik.WinControls.Paint.IGraphics graphics)
        {
            if (this.ElementState != ElementState.Loaded || !this.AllowImageAlignment)
            {
                base.PaintImage(graphics);
                return;
            }
            ImageList associatedImageList = this.ElementTree.ComponentTreeHandler.ImageList;

            if (associatedImageList != null && this.ImageIndex > -1 && this.ImageIndex < associatedImageList.Images.Count)
            {
                RadPanelBarGroupElement group = this.GetGroupElement();
                if (group != null)
                {
                    if (group.GetPanelBarElement() != null)
                    {
                        if (group.GetPanelBarElement().ElementTree != null)
                        {
                            if (this.Image == null)
                            {
                                this.Image = associatedImageList.Images[this.ImageIndex];
                            }
                        }
                    }
                }
            }
            else
            {
                if (associatedImageList != null && !String.IsNullOrEmpty(this.ImageKey))
                {
                    RadPanelBarGroupElement group = this.GetGroupElement();
                    if (group != null)
                    {
                        if (group.GetPanelBarElement() != null)
                        {
                            if (group.GetPanelBarElement().ElementTree != null)
                            {
                                if (this.Image == null)
                                {
                                    this.Image = associatedImageList.Images[this.ImageKey];
                                }
                            }
                        }
                    }
                }
            }

            int offset = InitialOffset + captionOffset;

            if (this.Image == null)
            {
                return;
            }

            if (this.ElementTree.Control.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
            {
                offset = this.Size.Width - InitialOffset - captionOffset - Image.Size.Width;
            }

            switch (this.ImageAlignment)
            {
            case ContentAlignment.BottomLeft:
                graphics.DrawBitmap(this.Image, offset, (this.Size.Height - this.Image.Height));
                break;

            case ContentAlignment.BottomCenter:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, (this.Size.Height - this.Image.Height));
                break;

            case ContentAlignment.BottomRight:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, (this.Size.Height - this.Image.Height));
                break;

            case ContentAlignment.MiddleLeft:
                graphics.DrawBitmap(this.Image, offset, (this.Size.Height - this.Image.Height) / 2);
                break;

            case ContentAlignment.MiddleRight:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, (this.Size.Height - this.Image.Height) / 2);
                break;

            case ContentAlignment.MiddleCenter:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, (this.Size.Height - this.Image.Height) / 2);
                break;

            case ContentAlignment.TopLeft:
                graphics.DrawBitmap(this.Image, offset, 0);
                break;

            case ContentAlignment.TopCenter:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, 0);
                break;

            case ContentAlignment.TopRight:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, 0);
                break;
            }
        }
Example #5
0
 public void PaintPrimitive(Telerik.WinControls.Paint.IGraphics graphics, TextParams textParams)
 {
     this.PaintPrimitive(graphics, 0f, new SizeF(1f, 1f), textParams);
 }