示例#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);
        }
示例#2
0
        public Pen GetPen()
        {
            PenData data = this.GetPenData();

            if (data == null)
            {
                return(null);
            }
            else
            {
                return(data.GetPen());
            }
        }
示例#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();
            }
        }
示例#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));
        }
示例#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);
 }