示例#1
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            WhiskeyColor wc = (WhiskeyColor)e.Value;

            using (SolidBrush brush = new SolidBrush(UIManager.convertColor(wc)))
            {
                e.Graphics.FillRectangle(brush, e.Bounds);
            }

            //e.Graphics.DrawRectangleProper(Pens.Black, e.Bounds);
        }
示例#2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            // show the list box
            if (service != null && value is Light)
            {
                //service.ShowDialog();

                //DialogResult result = service.ShowDialog(colorDialog as Form);

                DialogResult result = colorDialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    SysColor     color        = colorDialog.Color;
                    WhiskeyColor whiskeyColor = UIManager.convertColor(color);

                    Light l = (Light)value;
                    l.Color = whiskeyColor;
                }
            }

            return(value);
        }