public void addBugview(BugInfo bug) { bugList.BeginUpdate(); ListViewItem item = new ListViewItem(); item.Text = ""; item.SubItems.Add(bug.id); item.SubItems.Add(bug.title); item.SubItems.Add("").Tag = false; bugList.Items.Add(item); bugList.EndUpdate(); }
/// <summary> /// 获取选中的BUG信息 /// </summary> /// <returns></returns> public List <BugInfo> getSelecteBugs() { List <BugInfo> result = new List <BugInfo>(); if (bugs == null) { return(result); } foreach (ListViewItem item in bugList.Items) { if (item.Checked) { BugInfo bug = queryBugById(item.SubItems[1].Text); result.Add(bug); } } return(result); }
private void bugListHit(ListViewHitTestInfo hit) { ListViewItem.ListViewSubItem subItem = hit.SubItem; //任务已解决 if (hit.Item.SubItems[3] == subItem) { BugInfo bug = queryBugById(hit.Item.SubItems[1].Text); bug.isDone = (bool)subItem.Tag; //绘制复选框 drawCheckBox(bugList, subItem, (bool)subItem.Tag); } if (hit.Item.Tag == null) { hit.Item.Tag = false; } hit.Item.Tag = !(bool)hit.Item.Tag; hit.Item.Checked = (bool)hit.Item.Tag; }