/// <summary> /// Create a OlvListViewHitTestInfo /// </summary> public OlvListViewHitTestInfo(OLVListItem olvListItem, OLVListSubItem subItem, int flags, OLVGroup group) { this.item = olvListItem; this.subItem = subItem; this.location = ConvertNativeFlagsToDotNetLocation(olvListItem, flags); this.HitTestLocationEx = (HitTestLocationEx)flags; this.Group = group; switch (location) { case ListViewHitTestLocations.StateImage: this.HitTestLocation = HitTestLocation.CheckBox; break; case ListViewHitTestLocations.Image: this.HitTestLocation = HitTestLocation.Image; break; case ListViewHitTestLocations.Label: this.HitTestLocation = HitTestLocation.Text; break; default: if ((this.HitTestLocationEx & HitTestLocationEx.LVHT_EX_GROUP_COLLAPSE) == HitTestLocationEx.LVHT_EX_GROUP_COLLAPSE) this.HitTestLocation = HitTestLocation.GroupExpander; else if ((this.HitTestLocationEx & HitTestLocationEx.LVHT_EX_GROUP_MINUS_FOOTER_AND_BKGRD) != 0) this.HitTestLocation = HitTestLocation.Group; else this.HitTestLocation = HitTestLocation.Nothing; break; } }
/// <summary> /// Update the given row using the given hot item information /// </summary> /// <param name="rowIndex"></param> /// <param name="columnIndex"></param> /// <param name="hitLocation"></param> /// <param name="olvi"></param> protected virtual void UpdateHotRow(int rowIndex, int columnIndex, HitTestLocation hitLocation, OLVListItem olvi) { if (rowIndex < 0 || columnIndex < 0) return; if (this.UseHyperlinks) { OLVColumn column = this.GetColumn(columnIndex); OLVListSubItem subItem = olvi.GetSubItem(columnIndex); if (column.Hyperlink && hitLocation == HitTestLocation.Text && !String.IsNullOrEmpty(subItem.Url)) { this.ApplyCellStyle(olvi, columnIndex, this.HyperlinkStyle.Over); this.Cursor = this.HyperlinkStyle.OverCursor ?? Cursors.Default; } else { this.Cursor = Cursors.Default; } } if (this.UseHotItem) { if (!olvi.Selected) { this.ApplyRowStyle(olvi, this.HotItemStyle); } } }
/// <summary> /// Create a OlvListViewHitTestInfo when the header was hit /// </summary> public OlvListViewHitTestInfo(ObjectListView olv, int iColumn, bool isOverCheckBox, int iDivider) { this.ListView = olv; this.ColumnIndex = iColumn; this.HeaderDividerIndex = iDivider; this.HitTestLocation = isOverCheckBox ? HitTestLocation.HeaderCheckBox : (iDivider < 0 ? HitTestLocation.Header : HitTestLocation.HeaderDivider); }