private void colorGrid_EditingColor(object sender, EditColorCancelEventArgs e) { e.Cancel = true; using (ColorDialog dialog = new ColorDialog { FullOpen = true, Color = e.Color }) { if (dialog.ShowDialog(this) == DialogResult.OK) { colorGrid.Colors[e.ColorIndex] = dialog.Color; } } }
private void colorGrid_EditingColor(object sender, EditColorCancelEventArgs e) { e.Cancel = true; using (ColorDialog dialog = new ColorDialog { FullOpen = true, Color = e.Color }) { if (dialog.ShowDialog(this) == DialogResult.OK) { colorGrid.Colors[e.ColorIndex] = dialog.Color; } } }
private void StartColorEdit(int index) { EditColorCancelEventArgs e; e = new EditColorCancelEventArgs(this.GetColor(index), index); this.OnEditingColor(e); if (!e.Cancel) { this.EditColor(index); } }
/// <summary> /// Raises the <see cref="EditingColor" /> event. /// </summary> /// <param name="e">The <see cref="CancelEventArgs" /> instance containing the event data.</param> protected virtual void OnEditingColor(EditColorCancelEventArgs e) { EventHandler<EditColorCancelEventArgs> handler; handler = this.EditingColor; if (handler != null) { handler(this, e); } }