protected override void Draw(PaintArgs p, ScaleDiscreetItemCollection items, Point centerPoint, int activeIndex, Color backColor) { if (base.Visible) { DrawStringFormat genericTypographic = DrawStringFormat.GenericTypographic; genericTypographic.LineAlignment = StringAlignment.Near; genericTypographic.Alignment = StringAlignment.Near; genericTypographic.FormatFlags |= StringFormatFlags.NoClip; for (int i = 0; i < items.Count; i++) { Font font; Color color; if (i == activeIndex) { font = base.TextActiveFont; color = base.TextActiveForeColor; } else { font = base.TextInactiveFont; color = base.TextInactiveForeColor; } if (base.Markers.Style != MarkerStyleLabel.None) { ((IScaleDiscreetMarker)base.Markers).Draw(p, items[i].MarkerPoint, backColor); } if (!items[i].LinePoint1.IsEmpty && !items[i].LinePoint2.IsEmpty) { p.Graphics.DrawLine(p.Graphics.Pen(Color.Black), items[i].LinePoint1, items[i].LinePoint2); } if (!items[i].LinePoint2.IsEmpty && !items[i].LinePoint3.IsEmpty) { p.Graphics.DrawLine(p.Graphics.Pen(Color.Black), items[i].LinePoint2, items[i].LinePoint3); } p.Graphics.DrawString(items[i].Text, font, p.Graphics.Brush(color), items[i].TextRectangle, genericTypographic); } } }
protected override void Calculate(PaintArgs p, ScaleDiscreetItemCollection items, Point centerPoint, int activeIndex, int pointerExtent) { if (base.Visible) { DrawStringFormat genericTypographic = DrawStringFormat.GenericTypographic; genericTypographic.LineAlignment = StringAlignment.Near; genericTypographic.Alignment = StringAlignment.Near; for (int i = 0; i < items.Count; i++) { Font font = (i != activeIndex) ? base.TextInactiveFont : base.TextActiveFont; Size textSize = p.Graphics.MeasureString(items[i].Text, font, true); double angle = this.ScaleRange.ValueToAngle(i, items.Count); int num = pointerExtent + base.Margin; if (base.Markers.Style != MarkerStyleLabel.None) { items[i].MarkerPoint = Math2.ToRotatedPoint(angle, (double)(num + base.Markers.Size), centerPoint); num += 2 * base.Markers.Size; } items[i].LinePoint1 = Point.Empty; items[i].LinePoint2 = Point.Empty; items[i].LinePoint3 = Point.Empty; if (this.TextAlignment == StringAlignmentDiscreetAngular.Center) { this.CalculateLabelCenter(items[i], textSize, angle, num, centerPoint); } else if (this.TextAlignment == StringAlignmentDiscreetAngular.CallOut) { this.CalculateLabelCallout(items[i], textSize, angle, num, centerPoint); } else if (this.TextAlignment == StringAlignmentDiscreetAngular.Justified) { this.CalculateLabelJustified(items[i], textSize, angle, num, centerPoint); } } } }
protected abstract void Draw(PaintArgs p, ScaleDiscreetItemCollection items, Point centerPoint, int activeIndex, Color backColor);
protected abstract void Calculate(PaintArgs p, ScaleDiscreetItemCollection items, Point centerPoint, int activeIndex, int pointerExtent);
void IScaleDisplayDiscreet.Draw(PaintArgs p, ScaleDiscreetItemCollection items, Point centerPoint, int activeIndex, Color backColor) { this.Draw(p, items, centerPoint, activeIndex, backColor); }
void IScaleDisplayDiscreet.Calculate(PaintArgs p, ScaleDiscreetItemCollection items, Point centerPoint, int activeIndex, int pointerExtent) { this.Calculate(p, items, centerPoint, activeIndex, pointerExtent); }