public StandardHiddenRowCoordinator(RowsBase rows) { this.m_rows = rows; rows.RowVisibilityChanged += delegate(int rowIndex, bool becameVisible) { var range = new Range(rowIndex, 0, rowIndex, 1); if (becameVisible) { m_rowMerger.RemoveRange(range); } else { m_rowMerger.AddRange(range); } //rowmerger had the correct count of hidden rows. m_totalHiddenRows = m_rowMerger.GetRowsIndex().Count; }; /*[email protected]: The below event handler was blindly incrementing or decrementing values. * The issue with this is : * Say after loading the grid with one hidden row, user sets the RowsCount of the same grid to 0. * Making the grid empty. At that time this event is not triggered and m_totalHiddenRows value will not be decremented. * Now if you load the grid again with 1 hidden row, this will get incremented to 2. Which is wrong*/ //rows.RowVisibilityChanged += delegate(int rowIndex, bool becameVisible) //{ //if (becameVisible == true) // m_totalHiddenRows -= 1; //else // m_totalHiddenRows += 1; //if (m_totalHiddenRows < 0) // throw new SourceGridException("Total hidden rows becamse less than 0. This indicates a bug"); //}; }
public StandardHiddenRowCoordinator(RowsBase rows) { this.m_rows = rows; rows.RowVisibilityChanged += delegate(int rowIndex, bool becameVisible) { var range = new GridRange(rowIndex, 0, rowIndex, 1); if (becameVisible) { m_rowMerger.RemoveRange(range); } else { m_rowMerger.AddRange(range); } }; rows.RowVisibilityChanged += delegate(int rowIndex, bool becameVisible) { if (becameVisible == true) { m_totalHiddenRows -= 1; } else { m_totalHiddenRows += 1; } if (m_totalHiddenRows < 0) { throw new SourceGridException("Total hidden rows becamse less than 0. This indicates a bug"); } }; }
/// <summary> /// Grid constructor /// </summary> public GridVirtual() { SetStyle(ControlStyles.Selectable, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.ContainerControl, true); TabStop = true; m_Rows = CreateRowsObject(); m_Columns = CreateColumnsObject(); SelectionMode = GridSelectionMode.Cell; //Create the Controller list for the Cells Controller.AddController(Cells.Controllers.StandardBehavior.Default); Controller.AddController(Cells.Controllers.CellEventDispatcher.Default); Controller.AddController(Cells.Controllers.MouseSelection.Default); m_LinkedControls = new LinkedControlsList(this); //ToolTip toolTip = new System.Windows.Forms.ToolTip(); ToolTipText = ""; }
public StandardHiddenRowCoordinator(RowsBase rows) { this.m_rows = rows; rows.RowVisibilityChanged += delegate(int rowIndex, bool becameVisible) { var range = new Range(rowIndex, 0, rowIndex, 1); if (becameVisible) m_rowMerger.RemoveRange(range); else m_rowMerger.AddRange(range); }; rows.RowVisibilityChanged += delegate(int rowIndex, bool becameVisible) { if (becameVisible == true) m_totalHiddenRows -= 1; else m_totalHiddenRows += 1; if (m_totalHiddenRows < 0) throw new SourceGridException("Total hidden rows becamse less than 0. This indicates a bug"); }; }