private void btnColor_Click(object sender, EventArgs e) { try { var connData = _bs.Current as ConnectionData; using (var dialog = new Dialog.ColorDialog()) { if (dialog.ShowDialog(this) == DialogResult.OK) { connData.Color = dialog.SelectedColor; btnColor.BackColor = dialog.SelectedColor; } } } catch (Exception ex) { Utils.HandleError(ex); } }