1. 复制
DataGridViewSelectedCellCollection ds;
ds = dataGridView1.SelectedCells;
DataGridViewSelectedRowCollection dr = dataGridView1.SelectedRows;
DataGridViewSelectedColumnCollection dc = dataGridView1.SelectedColumns;
row1 = dataGridView1.SelectedCells[dataGridView1.SelectedCells.Count - 1].RowIndex; //起始行
col1 = dataGridView1.SelectedCells[dataGridView1.SelectedCells.Count - 1].ColumnIndex;//起始列
row2 = dataGridView1.CurrentCell.RowIndex;//终止行
col2 = dataGridView1.CurrentCell.ColumnIndex;//终止列
rowcounts = row2 - row1 + 1;//选中行数
colcounts = col2 - col1 + 1;//选中列数
selcells = new string[rowcounts, colcounts];//定义一个二维数组,保存复制后的数据
for (int i = 0; i < rowcounts; i++)
for (int k = 0; k < colcounts; k++)
{
if (dataGridView1.Rows[row1 + i].Cells[col1 + k].Value.ToString() =