Ejemplo n.º 1
0
        private void UpdateRows()
        {
            if (m_results.Length == 0)
            {
                Rows.Clear();
                RowCount = 1;
                SetCurrentRow(0);
            }
            else
            {
                if (m_results.Length < RowCount - 1000)//rows are removed very slowly!!!
                {
                    Rows.Clear();
                }
                RowCount = m_results.Length;

                bool[] selection = m_core.GetSelection(0, (uint)m_results.Length);

                for (int i = 0; i < Rows.Count; i++)
                {
                    DataGridViewCustomRow row = (DataGridViewCustomRow)Rows[i];
                    row.updated = false;
                    if (selection != null)
                    {
                        row.selected = selection[i];
                    }
                }
                int current = m_core.GetCurrent();
                if (current != -1)
                {
                    SetCurrentRow(current);
                }
                else
                {
                    SetCurrentRow(0);
                    SetRowSelection(0, 1, true);
                }
            }
        }