如何将 "clipboard copymode= disable" 设置为冻结列

How to set "clipboard copymode= disable" to frozen columns

我不想从 datagridview 冻结的列中复制值。只有我可以复制解冻列。如何解决?

我认为 DGV 或其 Cells 中没有 属性。但是在 EditingControl 中有:

// subscribe to the event that goes with entering edit mode:
private void dataGridView1_EditingControlShowing(object sender, 
                           DataGridViewEditingControlShowingEventArgs e)
{
    // get a reference to the currently showing edit control:
    DataGridViewTextBoxEditingControl tb = DataGridViewTextBoxEditingControl) e.Control;

    // disallow the standard actions
    tb.ShortcutsEnabled = 
      !dataGridView1.Columns[dataGridView1.CurrentCell.ColumnIndex].Frozen;

}

我们还需要在不进入编辑模式的情况下禁止键盘复制:

private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
    if (dataGridView1.Columns[dataGridView1.CurrentCell.ColumnIndex].Frozen) 
        e.Handled = true;
}