private void attributeView_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) { if (!onEditing) { if (e.ColumnIndex >= 0) { for (int i = 0; i < attributeView.Rows.Count; ++i) { if (attributeView.Rows[i].HeaderCell.Selected || attributeView.Rows[i].Cells[e.ColumnIndex].Selected) { attributeView.Rows[i].Selected = true; } } } else { if (e.RowIndex >= 0) { attributeView.Rows[e.RowIndex].Selected = true; } } selectingFeatureIndexes = new int[attributeView.SelectedRows.Count]; for (int i = 0; i < attributeView.SelectedRows.Count; ++i) { selectingFeatureIndexes[i] = (int)(uint)attributeView.SelectedRows[i].Cells[0].Value; } SelectingFeatureChanged?.Invoke(this, selectingFeatureIndexes); } }
private void 取消选择ToolStripMenuItem_Click(object sender, EventArgs e) { for (int i = 0; i < attributeView.Rows.Count; ++i) { attributeView.Rows[i].Selected = false; } SelectingFeatureChanged?.Invoke(this, null); }
private void 全部选择ToolStripMenuItem_Click(object sender, EventArgs e) { selectingFeatureIndexes = new int[attributeView.Rows.Count]; for (int i = 0; i < attributeView.Rows.Count; ++i) { attributeView.Rows[i].Selected = true; selectingFeatureIndexes[i] = i; } SelectingFeatureChanged?.Invoke(this, selectingFeatureIndexes); }