Пример #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>
 /// Copy constructor.
 /// </summary>
 /// <param name="src">Source object to copy</param>
 public LineDecorator(LineDecorator src)
 {
     this.line           = null;
     this.linePoints     = null;
     this.propertyValues = (Hashtable)src.propertyValues.Clone();
     this.CreateStyles();
 }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="culture"></param>
 /// <param name="value"></param>
 /// <param name="destinationType"></param>
 /// <returns></returns>
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         if (value == null)
         {
             return("(none)");
         }
         else
         {
             LineDecorator lineDecorator = value as LineDecorator;
             if (lineDecorator != null)
             {
                 return(lineDecorator.GetType().Name);
             }
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Пример #4
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);
        }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="src"></param>
 public FilledLineDecorator(LineDecorator src) : base(src)
 {
     this.fillStyle = new FillStyle(this);
 }