DataGridView
有两个类似的事件处理程序:CellDoubleClick
和CellMouseDoubleClick
。这些有什么区别?
答案 0 :(得分:1)
CellDoubleClick和CellClick是从左鼠标按钮触发的事件,以及从Tab键到项目并点击空格键等的“点击”。
鼠标点击任意按钮即可获得MouseDoubleClick和MouseClick。答案 1 :(得分:0)
CellDoubleClick事件接收有关鼠标的更多信息。如果事件处理程序需要有关鼠标位置的信息,请使用CellMouseDoubleClick事件。
请参阅:http://msdn.microsoft.com/de-de/library/system.windows.forms.datagridview.celldoubleclick.aspx
http://msdn.microsoft.com/de-de/library/system.windows.forms.datagridview.cellmousedoubleclick.aspx
CellMouseDoubleClick-Event接收点击次数,位置(点,X,Y),MouseButton等
答案 2 :(得分:0)
TL;博士 双击任何鼠标按钮时会触发CellDoubleClick。 只有在双击LEFT按钮时才会触发CellMouseDoubleClick。
// Fires EVERY time ANY mouse button moves down
private void dataGridView1_MouseDown(object sender, MouseEventArgs e)
{
Console.WriteLine("MouseDown Event: " + e.Button + " button." );
}
// Fires when the LEFT mouse button is double clicked
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
Console.WriteLine(" CellDoubleClick: LEFT Button was double clicked");
}
// Fires when ANY mouse button is double clicked
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
Console.WriteLine(" CellMouseDoubleClick Event: SOME Button was double clicked");
}
结果是:
// MouseDown Event: Left button.
// MouseDown Event: Left button.
// CellDoubleClick: LEFT Button was double clicked
// CellMouseDoubleClick Event: SOME Button was double clicked
//
//
// MouseDown Event: Middle button.
// MouseDown Event: Middle button.
// CellMouseDoubleClick Event: SOME Button was double clicked
//
//
// MouseDown Event: Right button.
// MouseDown Event: Right button.
// CellMouseDoubleClick Event: SOME Button was double clicked