Exemple #1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(System.Configuration.Color))
            {
                return(value);
            }

            IWindowsFormsEditorService svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (svc != null)
            {
                System.Configuration.Color c = (System.Configuration.Color)value;
                var editor = new System.Drawing.Design.ColorEditor();
                System.Drawing.Color edited = (System.Drawing.Color)editor.EditValue(context, provider, System.Drawing.Color.FromArgb(c.R, c.G, c.B));

                c.R = edited.R;
                c.G = edited.G;
                c.B = edited.B;

                return(c);
            }

            return(value);
        }
Exemple #2
0
 private void ShowDropDown()
 {
     try
     {
         var editor = new ColorEditor();
         Color color = Color;
         object objectValue = RuntimeHelpers.GetObjectValue(editor.EditValue(_EditorService, color));
         if ((objectValue != null) && !_EditorService.Canceled)
         {
             Color = (Color) objectValue;
         }
         _CheckBox.CheckState = CheckState.Unchecked;
     }
     catch (Exception exception1)
     {
         // ProjectData.SetProjectError(exception1);
         Trace.WriteLine(exception1.ToString());
         // ProjectData.ClearProjectError();
     }
 }
 public ColorPalette(ColorEditor.ColorUI colorUI, Color[] customColors)
 {
     this.colorUI = colorUI;
     base.SetStyle(ControlStyles.Opaque, true);
     this.BackColor = SystemColors.Control;
     base.Size = new Size(0xca, 0xca);
     this.staticColors = new Color[0x30];
     for (int i = 0; i < staticCells.Length; i++)
     {
         this.staticColors[i] = ColorTranslator.FromOle(staticCells[i]);
     }
     this.customColors = customColors;
 }
 public ColorUI(ColorEditor editor)
 {
     this.editor = editor;
     this.InitializeComponent();
     this.AdjustListBoxItemHeight();
 }
 public ColorCellAccessibleObject(ColorEditor.ColorPalette.ColorPaletteAccessibleObject parent, Color color, int cell)
 {
     this.color = color;
     this.parent = parent;
     this.cell = cell;
 }
 public ColorUI(ColorEditor editor)
 {
     this.editor = editor;
     InitializeComponent();
     AdjustListBoxItemHeight();
 }