private void _channelsDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == 1 && e.RowIndex >= 0 && e.RowIndex < _channelItemsBindingSource.Count) { LinkedChannelItem linkItem = _channelsDataGridView.Rows[e.RowIndex].DataBoundItem as LinkedChannelItem; if (linkItem != null) { e.CellStyle.ForeColor = linkItem.RowColor; e.CellStyle.SelectionForeColor = linkItem.RowColor; } } }
private void _linkChannelButton_Click(object sender, EventArgs e) { if (_channelsDataGridView.SelectedRows.Count > 0) { LinkedChannelItem linkItem = _channelsDataGridView.SelectedRows[0].DataBoundItem as LinkedChannelItem; CreateChannelLinkForm form = new CreateChannelLinkForm(); form.Channel = linkItem.Channel; if (form.ShowDialog() == DialogResult.OK) { ChannelLinks.Save(); string message; Color rowColor; GetLinkedMessageAndColor(linkItem.Channel, out message, out rowColor); linkItem.Message = message; linkItem.RowColor = rowColor; _channelItemsBindingSource.ResetBindings(false); } } }