Ejemplo n.º 1
0
        public void SetPenData(PenData value)
        {
            IBrushData bd = (value == null) ? null : value.Brush;

            this.rbSolid.Tag    = (bd is SolidBrushData) ? value : new PenData(new SolidBrushData());
            this.rbGradient.Tag = (bd is LinearGradientBrushData) ? value : new PenData(new LinearGradientBrushData());
            this.rbHatch.Tag    = (bd is HatchBrushData) ? value : new PenData(new HatchBrushData());
            this.TurnOnRadioButton(bd);
        }
Ejemplo n.º 2
0
        public Pen GetPen()
        {
            PenData data = this.GetPenData();

            if (data == null)
            {
                return(null);
            }
            else
            {
                return(data.GetPen());
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Draw a representation of our value
        /// </summary>
        public override void PaintValue(PaintValueEventArgs e)
        {
            PenData p = e.Value as PenData;

            if (p == null)
            {
                base.PaintValue(e);
            }
            else
            {
                e.Graphics.SetClip(e.Bounds);
                e.Graphics.DrawLine(p.GetPen(), e.Bounds.Left, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom);
                e.Graphics.ResetClip();
            }
        }
Ejemplo n.º 4
0
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                PenData p = value as PenData;
                if (p == null || p.Brush == null)
                {
                    return("(none)");
                }
                else
                {
                    string name = p.Brush.GetType().Name;
                    return(name.Substring(0, name.Length - "BrushData".Length) + "Pen");
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Ejemplo n.º 5
0
 public void SetPenData(PenData value)
 {
     IBrushData bd = (value == null) ? null : value.Brush;
     this.rbSolid.Tag = (bd is SolidBrushData) ? value : new PenData(new SolidBrushData());
     this.rbGradient.Tag = (bd is LinearGradientBrushData) ? value : new PenData(new LinearGradientBrushData());
     this.rbHatch.Tag = (bd is HatchBrushData) ? value : new PenData(new HatchBrushData());
     this.TurnOnRadioButton(bd);
 }