コード例 #1
0
 public void ShowColorDialog()
 {
     using (ColorPickerForm dialogColor = new ColorPickerForm(Color))
     {
         if (dialogColor.ShowDialog() == DialogResult.OK)
         {
             Color = dialogColor.NewColor;
         }
     }
 }
コード例 #2
0
        public static Color GetColor(Color currentColor)
        {
            using (ColorPickerForm dialog = new ColorPickerForm(currentColor))
            {
                dialog.rbSaturation.Checked = true;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    return(dialog.NewColor);
                }
            }

            return(currentColor);
        }
コード例 #3
0
ファイル: MyColorEditor.cs プロジェクト: andre-d/ShareXYZ
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(Color))
            {
                return(value);
            }

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

            if (svc != null)
            {
                Color color = (Color)value;

                using (ColorPickerForm form = new ColorPickerForm(color))
                {
                    if (svc.ShowDialog(form) == DialogResult.OK)
                    {
                        return((Color)form.NewColor);
                    }
                }
            }

            return(value);
        }