1

I need to do something when a cell is modified via pasted content, I don't seem to find any event that gets fired while/after text is pasted into the cell.

I have tried: ValueChanged CellValidating CellPaint CellValuePushed CellValueNeeded Validating

in a desperate attempt of finding out what fires, I know some of those events obviously won't fire.

My problem is that I can't seem to catch the event of paste, I would think and hope there IS an event linked to the action.

Using RadForms 2012Q3 RadGridView control.

Thanks in advance!

4

2 回答 2

0

我知道有点晚了,但是WPF中有三个:

  • 已粘贴
  • 粘贴
  • 粘贴单元格剪贴板内容

我不知道WinForms是否不同......

于 2013-06-16T13:38:47.937 回答
0

很抱歉加入晚会,使用 Telerik WinForms 来实现粘贴,例如,您有“粘贴”事件(Telerik Copy/Past/Cut docs

首先,调用对象上的事件:

yourGrid.Pasting += YourGrid_Pasting; 

然后检索值并使用它:

    private void YourGrid_Pasting(object sender, GridViewClipboardEventArgs e)
    {
        if (Clipboard.ContainsData(DataFormats.Text))
        {
            string data = Clipboard.GetData(DataFormats.Text).ToString();
            if (data != string.Empty)
            {
                // data is your copied text                    
            }
        }
    }
于 2019-08-08T08:07:01.227 回答