private static OLVListItem NewItem(string first, string second) { OLVListItem result = new OLVListItem(first); //result.SubItems.Add(); OLVListSubItem newSub = new OLVListSubItem(); newSub.Text = second; result.SubItems.Add(newSub); return(result); }
private ListViewItem CreateBlankListViewItem() { var subItems = new OLVListSubItem[Columns.Count]; for (int i = 0; i < subItems.Length; ++i) { subItems[i] = new OLVListSubItem(); } return(new OLVListItem(null, subItems, -1)); }
public FormatCellArgs( OLVListSubItem item, int rowIndex, int displayIndex, int columnIndex, object cellValue) { RowIndex = rowIndex; DisplayIndex = displayIndex; ColumnIndex = columnIndex; Item = item; CellValue = cellValue; }
/// <summary> /// Given the item and the subitem, calculate its bounds. /// </summary> /// <param name="item"></param> /// <param name="subItem"></param> /// <returns></returns> public Rectangle CalculateItemBounds(OLVListItem item, OLVListSubItem subItem) { if (item == null) { return(Rectangle.Empty); } if (subItem == null) { return(item.Bounds); } else { return(item.GetSubItemBounds(item.SubItems.IndexOf(subItem))); } }
void tickler_ElapsedInThread() { // Handle death/destruction/hiding if (this.Column == null || this.ListView == null || this.ListView.IsDisposed || !this.Column.IsVisible || this.ListView.View != System.Windows.Forms.View.Details) { return; } Rectangle updateRect = new Rectangle(); List <object> objectsToRemove = new List <object>(); // Run through each visible row, checking to see if it should be animated int topIndex = this.ListView.TopItemIndex; int bottomIndex = topIndex + this.ListView.RowsPerPage; for (int i = topIndex; i <= bottomIndex; i++) { OLVListItem olvi = this.ListView.GetItem(i); if (olvi == null) { continue; } // Has this row been animating? object animatingModel = olvi.RowObject; if (!this.animationIndexMap.ContainsKey(olvi.RowObject)) { continue; } // Collect the area that must be redraw OLVListSubItem subItem = (OLVListSubItem)olvi.SubItems[this.Column.Index]; if (updateRect.IsEmpty) { updateRect = subItem.Bounds; } else { updateRect = Rectangle.Union(updateRect, subItem.Bounds); } // If it is still animating, advance to the next image, wrapping // at the end. If it is no longer animating, remove it. if (this.IsAnimating(animatingModel)) { int newIndex = this.GetAnimationIndex(animatingModel) + 1; if (newIndex >= this.ImageNames.Count - 1) { newIndex = 1; } this.animationIndexMap[animatingModel] = newIndex; // For virtual lists, it is enough to redraw the cell, // but for non-owner drawn, we have to be more forceful if (!this.ListView.VirtualMode) { subItem.ImageSelector = column.GetImage(animatingModel); this.ListView.SetSubItemImage(olvi.Index, this.Column.Index, subItem, false); } } else { objectsToRemove.Add(animatingModel); } } // Get rid of models that are no longer animating foreach (object key in objectsToRemove) { this.animationIndexMap.Remove(key); } // Force the listview to redraw the animated images if (!updateRect.IsEmpty) { this.ListView.Invalidate(updateRect); } }
/// <summary> /// Given the item and the subitem, calculate its bounds. /// </summary> /// <param name="item"></param> /// <param name="subItem"></param> /// <returns></returns> public Rectangle CalculateItemBounds(OLVListItem item, OLVListSubItem subItem) { if (item == null) return Rectangle.Empty; if (subItem == null) return item.Bounds; else return item.GetSubItemBounds(item.SubItems.IndexOf(subItem)); }
public ForwardingDecoration(OLVListItem item, OLVListSubItem subitem, ImageDecoration decoration) { this.item = item; this.subitem = subitem; this.decoration = decoration; }