private void listView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { List <SelectedElement> selectedItems = new List <SelectedElement>(); foreach (int index in listView.SelectedIndices) { SelectedElement s = new SelectedElement(); s.key = listView.Items[index].Text; selectedItems.Add(s); } foreach (var m in manList) { m.SelectedElements = selectedItems; } } // end item selection changed
private Label createFieldMarker(SelectedElement e, int markernumber) { const int HEIGHT = 12; const int PADDING = 4; const int MAXCHARS = 34; Label b = new Label(); b.SetBounds(picturebox.Left, picturebox.Bottom + (HEIGHT + PADDING) * markernumber + PADDING, MAINWIDTH, HEIGHT); b.AutoSize = true; if (e.value != null && e.value.Length > MAXCHARS) { b.Text = e.value.Substring(0, MAXCHARS) + "..."; } else { b.Text = e.value; } b.BackColor = getColorByCategory(e.category); b.FlatStyle = FlatStyle.Flat; b.Font = detailfont; return(b); }