这是我的 ListBox MouseMove 事件的代码:
private void lbxItems_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left) //this one is good
{
lbxItems.DoDragDrop("Copy Text 1", DragDropEffects.Copy);
}
else if (Control.ModifierKeys == Keys.Alt && e.Button == MouseButtons.Left) //this desn't work
{
lbxItems.DoDragDrop("Copy Text 2", DragDropEffects.Copy);
}
}
e.Button == MouseButtons.Left
单独的条件可以正常工作,但不适用于Control.ModifierKeys == Keys.Alt
. 我想知道 ListBox 控件是否可以识别 ALT 键 + 鼠标左键组合。有人可以建议吗?