private void listBox1_DrawItem(object sender, DrawItemEventArgs e) { if (e.Index >= 0 && e.Index < listBox1.Items.Count) { ListBoxRichItem lbi = listBox1.Items[e.Index] as ListBoxRichItem; lbi.DrawItem(e, 1); if (lbi.Tag != null && lbi.Tag is GCConfigRatedEntry) { GCConfigRatedEntry ge = lbi.Tag as GCConfigRatedEntry; string s = ge.Rating.ToString(); SizeF ss = e.Graphics.MeasureString(s, ListBoxRichItem.H1Font); Brush b = Brushes.Gray; if (ge.Rating > 0.0) { b = Brushes.DarkGreen; } else if (ge.Rating < 0.0) { b = Brushes.DarkRed; } e.Graphics.DrawString(s, ListBoxRichItem.H1Font, b, e.Bounds.Right - 8 - ss.Width, e.Bounds.Top + 8); } } }
private void toolStripButtonEdit_Click(object sender, EventArgs e) { ListBoxRichItem lbi = listBox1.Items[listBox1.SelectedIndex] as ListBoxRichItem; if (lbi.Tag != null && lbi.Tag is GCConfigRatedEntry) { GCConfigRatedEntry ge = lbi.Tag as GCConfigRatedEntry; RatedEventDetailsPanel d = new RatedEventDetailsPanel(); d.OnValueSaved += new TBButtonPressed(OnRatedEntryEdited); d.RatedEvent = ge; RatedEventDetailsPanelController dc = new RatedEventDetailsPanelController(d); dc.ShowInContainer(Controller.ViewContainer, GVControlAlign.Fill); } }
private void InitListbox(GCConfigRatedEntry ge) { listBox1.BeginUpdate(); listBox1.Items.Clear(); for (int i = 0; i < ge.MarginsCount; i++) { ListBoxRichItem lbi = new ListBoxRichItem(); lbi.Tag = ge[i]; lbi.Title = ge[i].Title; lbi.Subtitle = string.Format("Period {0} min - {1} min rel to starting time", ge[i].OffsetMinutesStart, ge[i].OffsetMinutesEnd); listBox1.Items.Add(lbi); } listBox1.EndUpdate(); }
private void setRatedEvent(GCConfigRatedEntry ge) { if (ge != null) { originalEncodedString = ge.EncodedString; label4.Text = ge.Title; numericUpDown3.Value = Convert.ToDecimal(ge.Rating); if (ge.Note != null) { richTextBox2.Text = ge.Note; } else { richTextBox2.Text = ""; } InitListbox(ge); } }