Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            DialogColor colorDialog = new DialogColor(Color.DarkBlue);
            colorDialog.ShowDialog();

            comboBox1.Items.AddRange(Enum.GetNames(typeof(DrawStyle)));
            comboBox1.SelectedIndex = 0;
            colorPicker.ColorChanged += new ColorEventHandler(colorPicker_ColorChanged);
        }
        private void btnBrowseColor_Click(object sender, EventArgs e)
        {
            using (DialogColor colorPicker = new DialogColor())
            {
                if (!string.IsNullOrEmpty(txtColor.Text))
                {
                    colorPicker.SetCurrentColor(MyColors.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);
                }
            }
        }