Exemple #1
0
            public override void PaintValue(PaintValueEventArgs e)
            {
                base.PaintValue(e);
                string s = e.Value as string;

                if (s != null)
                {
                    EntityColor color;
                    if (!EntityColor.TryParse(s, out color))
                    {
                        return;
                    }
                    using (Brush brush = (Brush) new SolidBrush((System.Drawing.Color)color.ToArgbColor(DxfIndexedColorSet.AcadClassicIndexedColors)))
                        e.Graphics.FillRectangle(brush, e.Bounds);
                }
                else
                {
                    if (!(e.Value is EntityColor))
                    {
                        return;
                    }
                    using (Brush brush = (Brush) new SolidBrush((System.Drawing.Color)((EntityColor)e.Value).ToArgbColor(DxfIndexedColorSet.AcadClassicIndexedColors)))
                        e.Graphics.FillRectangle(brush, e.Bounds);
                }
            }
Exemple #2
0
            public override object ConvertFrom(
                ITypeDescriptorContext context,
                CultureInfo culture,
                object value)
            {
                string      s = value as string;
                EntityColor color;

                if (s != null && EntityColor.TryParse(s, out color))
                {
                    return((object)color);
                }
                return(value);
            }