/// <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); } }