public int Compare(object x, object y) { if (sortOrder == SortOrder.None) { return(0); } OLVListItem itemX = x as OLVListItem; OLVListItem itemY = y as OLVListItem; var objValueX = itemX.GetSubItem(column.Index).ModelValue; var objValueY = itemY.GetSubItem(column.Index).ModelValue; long res = 0; if (objValueX is string || objValueY is string) { res = string.Compare((string)objValueX, (string)objValueY); } if (objValueX is long || objValueY is long) { long valueX = objValueX != null ? (long)objValueX : 0; long valueY = objValueY != null ? (long)objValueY : 0; res = sortMode == DumpDiffModule.SortMode.AbsValue ? Math.Abs(valueX) - Math.Abs(valueY) : valueX - valueY; } return(sortOrder == SortOrder.Ascending ? (int)res : -(int)res); }
private void ColorListViewItemIfModified(OLVListItem item) { if (IsListViewItemModified(item)) { for (int x = 0; x < item.SubItems.Count; x++) { item.GetSubItem(x).BackColor = Color.Tomato; } } }
/// <summary> /// Calculate the edit rectangle /// </summary> /// <param name="g"></param> /// <param name="cellBounds"></param> /// <param name="item"></param> /// <param name="subItemIndex"></param> /// <returns></returns> public override Rectangle GetEditRectangle(Graphics g, Rectangle cellBounds, OLVListItem item, int subItemIndex) { this.ClearState(); this.ListView = (ObjectListView)item.ListView; this.ListItem = item; this.SubItem = item.GetSubItem(subItemIndex); this.Column = this.ListView.GetColumn(subItemIndex); this.RowObject = item.RowObject; this.IsItemSelected = this.ListItem.Selected; this.Bounds = cellBounds; return this.HandleGetEditRectangle(g, cellBounds, item, subItemIndex); }