private void lbDestination_DrawItem(object sender, DrawItemEventArgs e) { var listBox = sender as ListBox; if (e.Index == -1 || listBox == null) { return; } var channelNum = e.Index; var name = _destinationProfile.GetChannelName(channelNum); var color = _destinationProfile.GetChannelColor(channelNum); e.DrawItemWide(name, color, _useCheckmark); }
private void ShowComponents(int start, bool save = true) { if (save) { SaveCurrentValues(); } for (var row = 0; row < _totalChannelsDisplayed; row++) { _labels[row].Text = _sourceProfile.GetChannelName(start + row); _labels[row].BackColor = _sourceProfile.GetChannelColor(start + row); _labels[row].ForeColor = _labels[row].BackColor.GetForeColor(); _textBoxes[row].Text = _destinationTextBoxText[_sourceProfile.GetChannelLocation(start + row)]; if (!_isPreview) { continue; } var s = _textBoxes[row].Text.Split(_splitChar, StringSplitOptions.RemoveEmptyEntries); var col = 0; foreach (var channel in s) { var channelNum = int.Parse(channel); var c = Controls.Find("r" + row + "c" + col, true)[0]; if (channelNum < _destinationNatural.GetChannelCount()) { c.Text = _destinationNatural.GetChannelName(channelNum); c.BackColor = _destinationNatural.GetChannelColor(channelNum); c.ForeColor = c.BackColor.GetForeColor(); c.Visible = true; } col++; } for (; col < _maxDestinationCount; col++) { Controls.Find("r" + row + "c" + col, true)[0].Visible = false; } } _currentTopChannelIndex = start; vsb.Value = start; }