public void SelectGroup(int rowHandle, bool select)
        {
            if (IsGroupRowSelected(rowHandle) && select)
            {
                return;
            }
            int count = view.GetChildRowCount(rowHandle);

            if (!EFMultiSelect && select && count > 1)
            {
                EFMessageBox.Show("只允许单选。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            for (int i = 0; i < view.GetChildRowCount(rowHandle); i++)
            {
                int childRowHandle = view.GetChildRowHandle(rowHandle, i);
                if (view.IsGroupRow(childRowHandle))
                {
                    SelectGroup(childRowHandle, select);
                }
                else
                {
                    //SelectRow(childRowHandle, select, false);
                    view.SetRowCellValue(childRowHandle, CheckMarkColumn, select);
                }
            }
            Invalidate();
        }
        public void SelectAll()
        {
            selection.Clear();
            ICollection dataSource = view.DataSource as ICollection;
            int         count      = dataSource.Count;

            if (!EFMultiSelect && count > 1)
            {
                EFMessageBox.Show("只允许单选。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DateTime timeNow = DateTime.Now;

            for (int i = 0; i < view.DataRowCount; i++)
            {
                view.SetRowCellValue(i, CheckMarkColumn, true);
            }
            //if (dataSource != null && count == view.DataRowCount)
            //    selection.AddRange(dataSource);  // fast
            //else
            //    for (int i = 0; i < view.DataRowCount; i++)  // slow
            //        selection.Add(view.GetRow(i));
            //Invalidate();
            System.Console.WriteLine("total spant " + (DateTime.Now - timeNow).TotalMilliseconds);
        }
Example #3
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     Int32.TryParse(this.efDevSpinPageSize.EditValue.ToString(), out PageSize);
     Int32.TryParse(this.efDevSpinPageTo.EditValue.ToString(), out PageTo);
     if (PageSize <= 0) //PageSize > TotalRecordCount
     {
         EF.EFMessageBox.Show("每页大小输入值有误,大于0。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         efDevSpinPageSize.SelectAll();
         return;
     }
     if (PageTo > pageCount || PageTo <= 0)
     {
         EFMessageBox.Show("跳转到页数,输入值有误.\r\n 提示:大于0小于总页数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         efDevSpinPageTo.SelectAll();
         return;
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }