Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        public override void PaintValue(PaintValueEventArgs e)
        {
            object value = e.Value;

            if (value != null)
            {
                LineDecorator lineDecorator = value as LineDecorator;

                if (lineDecorator != null)
                {
                    float    lineY = e.Bounds.Top + (e.Bounds.Height / 2.0f);
                    PointF[] pts   = new PointF[2];
                    pts[0] = new PointF(e.Bounds.Left, lineY);
                    pts[1] = new PointF(e.Bounds.Left + (e.Bounds.Width / 2), lineY);
                    this.paintLine.SetPoints(pts);
                    LineDecorator paintDecorator = (LineDecorator)lineDecorator.Clone();
                    if (paintDecorator != null)
                    {
                        FilledLineDecorator filledPaintDecorator = paintDecorator as FilledLineDecorator;
                        if (filledPaintDecorator != null)
                        {
                            filledPaintDecorator.FillStyle.Type  = FillStyle.FillType.Solid;
                            filledPaintDecorator.FillStyle.Color = Color.Black;
                        }
                        this.paintLine.LastEndPoint = paintDecorator;
                        int prevStack = Global.SelectMatrixStack(Global.RenderingStack);
                        Global.MatrixStack.Clear();
                        Global.MatrixStack.Push(e.Graphics.Transform);
                        this.paintLine.Draw(e.Graphics);
                        Global.MatrixStack.Pop();
                        Global.SelectMatrixStack(prevStack);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            object item = this.Items[e.Index];

            if (item != null)
            {
                e.DrawBackground();
                e.DrawFocusRectangle();

                Font font = new Font("Arial", 8);

                if (item.GetType() == typeof(string))
                {
                    e.Graphics.DrawString((string)item, font, System.Drawing.Brushes.Black, e.Bounds, StringFormat.GenericDefault);
                }
                else if (item.GetType() == typeof(DecoratorEntry))
                {
                    float    lineY = e.Bounds.Top + (e.Bounds.Height / 2.0f);
                    PointF[] pts   = new PointF[2];
                    pts[0] = new PointF(e.Bounds.Left + 10, lineY);
                    pts[1] = new PointF(e.Bounds.Right - 10, lineY);
                    this.itemLine.SetPoints(pts);
                    System.Type   decoratorType = ((DecoratorEntry)item).DecoratorType;
                    LineDecorator decorator     = (LineDecorator)Activator.CreateInstance(decoratorType);
                    if (decorator != null)
                    {
                        FilledLineDecorator filledDecorator = decorator as FilledLineDecorator;
                        if (filledDecorator != null)
                        {
                            filledDecorator.FillStyle.Type  = FillStyle.FillType.Solid;
                            filledDecorator.FillStyle.Color = Color.Black;
                        }
                        this.itemLine.LastEndPoint = decorator;
                        this.itemLine.Draw(e.Graphics);
                    }
                }
            }
            base.OnDrawItem(e);
        }