private static Color ShowColorDialog(Color color) { using (var dialog = new ColorChooserForm()) { dialog.Color = color; return dialog.ShowDialog() == DialogResult.OK ? dialog.Color : color; } }
private static Color GetColor(Color color) { using (var dialog = new ColorChooserForm()) { dialog.Color = color; if (dialog.ShowDialog() == DialogResult.OK) color = dialog.Color; } return color; }
private void panelColor_DoubleClick(object sender, EventArgs e) { using (var dialog = new ColorChooserForm()) { dialog.AlphaEnabled = false; Color c = this.panelColor.BackColor; dialog.Color = Color.FromArgb(255, c.R, c.G, c.B); if (dialog.ShowDialog() == DialogResult.OK) this.panelColor.BackColor = dialog.Color; } }
private void panelColor_DoubleClick(object sender, EventArgs e) { string tag = (sender as Control).Tag.ToString(); Color color; switch (tag) { case "START": color = this.panelStartColor.BackColor; break; case "END": color = this.panelEndColor.BackColor; break; default: color = this.panelTextColor.BackColor; break; } using (var dialog = new ColorChooserForm()) { dialog.Color = color; if (dialog.ShowDialog() == DialogResult.OK) { if (tag == "START") this.CurrentGradient.StartColor = dialog.Color; else if (tag == "END") this.CurrentGradient.EndColor = dialog.Color; this.RefreshDisplay(); } } }
private void ButtonColorClick(object sender, EventArgs e) { using (var dialog = new ColorChooserForm()) { dialog.AlphaEnabled = false; dialog.Color = Editor.Settings.ImageColorSettings.BackgroundColor.ToSystemColor(); if (dialog.ShowDialog() != DialogResult.OK) return; Editor.Settings.ImageColorSettings.BackgroundColor = dialog.Color.ToXnaColor(); this.pictureBox.ImageBackColor = Editor.Settings.ImageColorSettings.BackgroundColor; } }
private void ListBoxColorsDoubleClick(object sender, EventArgs e) { var index = this.listBoxColors.SelectedIndex; if (index < 0) return; using (var dialog = new ColorChooserForm()) { dialog.Color = Editor.Settings.Charting.Colors[index]; dialog.AlphaEnabled = false; if (dialog.ShowDialog(Windows.ChartSettingsForm) != DialogResult.OK) return; this.listBoxColors.DataSource = null; Editor.Settings.Charting.Colors[index] = dialog.Color; this.RefreshColors(); } }
private void ButtonAddClick(object sender, EventArgs e) { using (var dialog = new ColorChooserForm()) { dialog.Color = Color.White; if (dialog.ShowDialog() != DialogResult.OK) return; Editor.Settings.Charting.Colors.Add(dialog.Color); this.RefreshColors(); } }