/// <summary> /// The mouse has moved to the given pt. See if the hot item needs to be updated /// </summary> /// <param name="hti"></param> /// <remarks>This is the main entry point for hot item handling</remarks> protected virtual void UpdateHotItem(OlvListViewHitTestInfo hti) { if (!this.UseHotItem && !this.UseHyperlinks) return; int newHotRow = hti.RowIndex; int newHotColumn = hti.ColumnIndex; HitTestLocation newHotCellHitLocation = hti.HitTestLocation; // In non-details view, we treat any hit on a row as if it were a hit // on column 0 -- which (effectively) it is! if (newHotRow >= 0 && this.View != View.Details) newHotColumn = 0; if (this.HotRowIndex == newHotRow && this.HotColumnIndex == newHotColumn && this.HotCellHitLocation == newHotCellHitLocation) return; // Trigger the hotitem changed event HotItemChangedEventArgs args = new HotItemChangedEventArgs(); args.HotCellHitLocation = newHotCellHitLocation; args.HotColumnIndex = newHotColumn; args.HotRowIndex = newHotRow; args.OldHotCellHitLocation = this.HotCellHitLocation; args.OldHotColumnIndex = this.HotColumnIndex; args.OldHotRowIndex = this.HotRowIndex; this.OnHotItemChanged(args); // Update the state of the control this.HotRowIndex = newHotRow; this.HotColumnIndex = newHotColumn; this.HotCellHitLocation = newHotCellHitLocation; // If the event handler handled it complete, don't do anything else if (args.Handled) return; this.BeginUpdate(); try { this.Invalidate(); if (args.OldHotRowIndex != -1) this.UnapplyHotItem(args.OldHotRowIndex); if (this.HotRowIndex != -1) { // Virtual lists apply hot item style when fetching their rows if (this.VirtualMode) this.RedrawItems(this.HotRowIndex, this.HotRowIndex, true); else this.UpdateHotRow(this.HotRowIndex, this.HotColumnIndex, this.HotCellHitLocation, hti.Item); } if (this.UseHotItem && this.HotItemStyle != null && this.HotItemStyle.Overlay != null) { this.RefreshOverlays(); } } finally { this.EndUpdate(); } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected virtual void OnHotItemChanged(HotItemChangedEventArgs e) { if (this.HotItemChanged != null) this.HotItemChanged(this, e); }