Exemplo n.º 1
0
        protected override void OnMouseClick(MouseEventArgs mevent)
        {
            base.OnMouseClick(mevent);

            using (DialogColor dialogColor = new DialogColor(Color))
            {
                if (dialogColor.ShowDialog() == DialogResult.OK)
                {
                    Color = dialogColor.NewColor;
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnMouseClick(MouseEventArgs mevent)
        {
            base.OnMouseClick(mevent);

            using (DialogColor dialogColor = new DialogColor(Color))
            {
                if (dialogColor.ShowDialog() == DialogResult.OK)
                {
                    Color = dialogColor.NewColor;
                }
            }
        }
Exemplo n.º 3
0
 private void btnColorDialog_Click(object sender, EventArgs e)
 {
     using (DialogColor dialogColor = new DialogColor(Color.FromArgb(tbRed.Value, tbGreen.Value, tbBlue.Value)))
     {
         if (dialogColor.ShowDialog() == DialogResult.OK)
         {
             Color color = dialogColor.NewColor;
             tbRed.Value   = color.R;
             tbGreen.Value = color.G;
             tbBlue.Value  = color.B;
             DrawRedGreenBlue();
         }
     }
 }
Exemplo n.º 4
0
        public static Color GetColor(Color currentColor)
        {
            using (DialogColor dialog = new DialogColor(currentColor))
            {
                dialog.rbSaturation.Checked = true;

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

            return(currentColor);
        }
Exemplo n.º 5
0
 private void btnColorDialog_Click(object sender, EventArgs e)
 {
     using (DialogColor dialogColor = new DialogColor(Color.FromArgb(tbRed.Value, tbGreen.Value, tbBlue.Value)))
     {
         if (dialogColor.ShowDialog() == DialogResult.OK)
         {
             Color color = dialogColor.NewColor;
             tbRed.Value = color.R;
             tbGreen.Value = color.G;
             tbBlue.Value = color.B;
             DrawRedGreenBlue();
         }
     }
 }
Exemplo n.º 6
0
        public static Color GetColor(Color currentColor)
        {
            using (DialogColor dialog = new DialogColor(currentColor))
            {
                dialog.rbSaturation.Checked = true;

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

            return currentColor;
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(RGBA))
            {
                return(value);
            }
            IWindowsFormsEditorService svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (svc != null)
            {
                using (DialogColor form = new DialogColor((RGBA)value))
                {
                    if (svc.ShowDialog(form) == DialogResult.OK)
                    {
                        return(form.NewColor.RGBA);
                    }
                }
            }
            return(value);
        }
Exemplo n.º 8
0
        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 (DialogColor form = new DialogColor(color))
                {
                    if (svc.ShowDialog(form) == DialogResult.OK)
                    {
                        return (Color)form.NewColor;
                    }
                }
            }

            return value;
        }
Exemplo n.º 9
0
 private void SelectColor(Control pb, ref XmlColor color)
 {
     using (DialogColor dColor = new DialogColor(pb.BackColor))
     {
         if (dColor.ShowDialog() == DialogResult.OK)
         {
             pb.BackColor = dColor.NewColor;
             color = (Color)dColor.NewColor;
         }
     }
 }
Exemplo n.º 10
0
        private void btnBrowseColor_Click(object sender, EventArgs e)
        {
            using (DialogColor colorPicker = new DialogColor())
            {
                if (!string.IsNullOrEmpty(txtColor.Text))
                {
                    colorPicker.SetCurrentColor(ColorHelpers.ParseColor(txtColor.Text));
                }

                if (colorPicker.ShowDialog() == DialogResult.OK)
                {
                    Color color = colorPicker.Color;
                    txtColor.Text = string.Format("{0},{1},{2},{3}", color.A, color.R, color.G, color.B);
                }
            }
        }