private int DeleteRow(SourceGrid.Grid grid) { for (int i = 0; i < grid.Rows.Count; i++) { if (grid.Selection.IsSelectedRow(i)) { grid.Rows.Remove(i); grid.Refresh(); return(i); } } return(-1); }
/// <summary> /// /// </summary> /// <param name="grid"></param> /// <param name="rowMove">-1:down 1:up</param> /// <returns></returns> private int changeIndex(SourceGrid.Grid grid, int rowMove) { for (int i = 0; i < grid.Rows.Count; i++) { if (grid.Selection.IsSelectedRow(i)) { if (i + rowMove > grid.Rows.Count - 1) { MessageBox.Show("已到最底!"); return(-1); } else if (i + rowMove < 0) { MessageBox.Show("已到最顶!"); return(-1); } grid.Refresh(); return(i); } } return(-1); }