/// <summary> /// farpoint单元格单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void fpUserInformationDetails_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e) { // 判断点击的空间类型是否是.FpCheckBox) if (e.EditingControl is FarPoint.Win.FpCheckBox) { FarPoint.Win.FpCheckBox fpChk = (FarPoint.Win.FpCheckBox)e.EditingControl; // 判断是否被选中 if (fpChk.Checked) { if (!_userSel.Contains((int)this.fpUserInformationDetails.ActiveSheet.Cells[e.Row, 1].Value)) { //添加 记录用户信息 _userSel.Add((int)this.fpUserInformationDetails.ActiveSheet.Cells[e.Row, 1].Value); //checkbox赋值前,先移除CheckedChanged事件,然后加上 this.chkSelAll.CheckedChanged -= this.chkSelAll_CheckedChanged; chkSelAll.Checked = (_userSel.Count == _fpRowsCount - _fpRowsTitleCount) ? true : false; this.chkSelAll.CheckedChanged += this.chkSelAll_CheckedChanged; } } else { // 移除索引号 _userSel.Remove((int)this.fpUserInformationDetails.ActiveSheet.Cells[e.Row, 1].Value); // 全选/全不选checkbox设为未选中 this.chkSelAll.CheckedChanged -= this.chkSelAll_CheckedChanged; this.chkSelAll.Checked = false; this.chkSelAll.CheckedChanged += this.chkSelAll_CheckedChanged; } // 如果保存索引号件数是1,则修改按钮设为可用,否则设为不可用 this.tsBtnModify.Enabled = (_userSel.Count == 1) ? true : false; // 删除按钮 this.tsBtnDel.Enabled = (_userSel.Count >= 1) ? true : false; } }
/// <summary> /// farPoint单击 触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void fpDepartmentInfo_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e) { if (this._fpDepartmentInfo.ActiveSheet.Cells[e.Row, 1].Value != null) { // 判断点击的空间类型是否是.FpCheckBox) if (e.EditingControl is FarPoint.Win.FpCheckBox) { FarPoint.Win.FpCheckBox fpChk = (FarPoint.Win.FpCheckBox)e.EditingControl; // 判断是否被选中 if (fpChk.Checked) { // 保存索引号 if (!_departmentSel.Contains(this._fpDepartmentInfo.ActiveSheet.Cells[e.Row, 1].Value.ToString())) { _departmentSel.Add(this._fpDepartmentInfo.ActiveSheet.Cells[e.Row, 1].Value.ToString()); this._chkSelAll.CheckedChanged -= this.chkSelAll_CheckedChanged; this._chkSelAll.Checked = _departmentSel.Count == DepartmentInformationManagementBLL.GetRecordCountFromTable() ? true : false; this._chkSelAll.CheckedChanged += this.chkSelAll_CheckedChanged; } } else { // 移除索引号 _departmentSel.Remove(this._fpDepartmentInfo.ActiveSheet.Cells[e.Row, 1].Value.ToString()); // 全选/全不选checkbox设为未选中 this._chkSelAll.CheckedChanged -= this.chkSelAll_CheckedChanged; this._chkSelAll.Checked = false; this._chkSelAll.CheckedChanged += this.chkSelAll_CheckedChanged; } } // 删除按钮 this.tsBtnDel.Enabled = (_departmentSel.Count >= 1) ? true : false; this.除ToolStripMenuItem.Enabled = (_departmentSel.Count >= 1) ? true : false; } }
private void fpUserInfo_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e) { if (this.fpUserInfo.ActiveSheet.Cells[e.Row, 1] != null) { // 判断点击的空间类型是否是.FpCheckBox) if (e.EditingControl is FarPoint.Win.FpCheckBox) { FarPoint.Win.FpCheckBox fpChk = (FarPoint.Win.FpCheckBox)e.EditingControl; // 判断是否被选中 if (fpChk.Checked) { if (!_userSel.Contains(this.fpUserInfo.ActiveSheet.Cells[e.Row, 1].Value.ToString())) { _userSel.Add(this.fpUserInfo.ActiveSheet.Cells[e.Row, 1].Value.ToString()); } } else { // 移除索引号 _userSel.Remove(this.fpUserInfo.ActiveSheet.Cells[e.Row, 1].Value.ToString()); // 全选/全不选checkbox设为未选中 this.chkSelAll.CheckedChanged -= this.chkSelAll_CheckedChanged; this.chkSelAll.Checked = false; this.chkSelAll.CheckedChanged += this.chkSelAll_CheckedChanged; } // 如果保存索引号件数是1,则修改按钮设为可用,否则设为不可用 this.tsBtnModify.Enabled = (_userSel.Count == 1) ? true : false; // 删除按钮 this.tsBtnDel.Enabled = (_userSel.Count >= 1) ? true : false; //this.删除ToolStripMenuItem.Enabled = (_userSel.Count >= 1) ? true : false; } } }