我试图将数据行值从数据网格拖放到列表中。为了做到这一点,我有两个事件。但我怎么能传递两个值?
这是网格事件
private void dgv_Mapper1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
//this works
//dgv_Mapper1.DoDragDrop(dgv_Mapper1.SelectedRows[0].Cells[0].Value, DragDropEffects.Copy);
//this is what i want, to send two values
dgv_Mapper1.DoDragDrop(new { First = dgv_Mapper1.SelectedRows[0].Cells[0].Value, Last = dgv_Mapper1.SelectedRows[0].Cells[1].Value }, DragDropEffects.Copy);
}
这是列表事件 问题是我不了解如何访问该对象并获得这两个值。
private void list_Head1_DragDrop(object sender, DragEventArgs e)
{
//this works with one object
//list_Head1.Items.Add(e.Data.GetData(DataFormats.Text.ToString().Trim()));
}