public void MoveToCell(GLMouseEventArgs e) { GLDataGridView dgv = Parent as GLDataGridView; var g = GridRowCol(e.Location); // find row/col if (g != null) { if (g.Column < dgv.Rows[g.Row].CellCount) // if within the range of cells of the current row { var newcell = CellPara(g, e); // get cell and set up mouse event args if (newcell == currentcell) { currentcell.OnMouseCellMove(e); // same cell, its a move } else { if (currentcell != null) // different cell, its a leave on last { currentcell.OnMouseCellLeave(e); } currentcell = newcell; currentcell?.OnMouseCellEnter(e); // if we have a new cell, enter. } return; // stop } } if (currentcell != null) // did not get a cell, but if we have a current cell, we need to leave { currentcell.OnMouseCellLeave(e); currentcell = null; } }
protected override void OnMouseLeave(GLMouseEventArgs e) { base.OnMouseLeave(e); if (currentcell != null) { currentcell.OnMouseCellLeave(e); currentcell = null; } }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLDataGridViewCell.CompareTo(GLDataGridViewCell)"/> public int CompareTo(GLDataGridViewCell other) { if (other is GLDataGridViewCellText) { var otext = ((GLDataGridViewCellText)other).text; //System.Diagnostics.Debug.WriteLine($"compare {text} to {otext}"); return(text.CompareTo(otext)); } else { return(-1); } }
/// <summary> /// Sort as Dates /// </summary> /// <param name="l">Left Cell</param> /// <param name="r">Rigth Cell</param> /// <returns>-1 left is less than right, 0 equal, 1 left is greater than right</returns> public static int SortCompareDate(GLDataGridViewCell l, GLDataGridViewCell r) { var lt = l as GLDataGridViewCellText; var rt = r as GLDataGridViewCellText; if (lt != null && rt != null) { return(lt.Value.CompareDate(rt.Value)); } else { return(0); } }
/// <summary> /// Sort as Numeric /// </summary> /// <param name="l">Left Cell</param> /// <param name="r">Rigth Cell</param> /// <returns>-1 left is less than right, 0 equal, 1 left is greater than right</returns> public static int SortCompareNumeric(GLDataGridViewCell l, GLDataGridViewCell r) { var lt = l as GLDataGridViewCellText; var rt = r as GLDataGridViewCellText; if (lt != null && rt != null) { return(lt.Value.InvariantParseDouble(0).CompareTo(rt.Value.InvariantParseDouble(0))); } else { return(0); } }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLDataGridViewCell.CompareTo(GLDataGridViewCell)"/> public int CompareTo(GLDataGridViewCell other) { return(-1); }