visual C# 2008 程式設計樂活學 |
|
sd
更新時間:2009/10/24 下午 04:28:23 |
|
visual C# 2008 程式設計樂活學 這本書的13.2.1 click和doubleclick說連點兩下依序 觸發:MouseDown,click,DoubleClick,MouseUp。 但我自己測試是MouseDown,click,MouseUp,MouseDown,DoubleClick,MouseUp
中間多了MouseUp,MouseDown
測試程式碼是 private void MainForm_Click(object sender, EventArgs e) { label1.Text = label1.Text + " click"; }
private void MainForm_MouseDown(object sender, MouseEventArgs e) { label1.Text = label1.Text + " mousedown"; }
private void MainForm_MouseUp(object sender, MouseEventArgs e) { label1.Text = label1.Text + " mouseup"; }
private void MainForm_DoubleClick(object sender, EventArgs e) { label1.Text = label1.Text + " doubleclick"; }
|
|
|
|
文淵閣工作室
更新時間:2009/10/28 下午 04:04:23 |
|
謝謝您寶貴的意見。 以下是個人再次做的測試程式 結果是: My test Order is: 1:MouseDown,1:Click,3:MouseClick,4:MouseUp,5:MouseDown,6:DoubleClick,7:MouseUp
int n = 0; private void Form1_MouseClick(object sender, MouseEventArgs e) { n++; label1.Text += (n.ToString () + ":MouseClick,"); }
private void Form1_Click(object sender, EventArgs e) { n++; label1.Text += (n.ToString() + ":Click,"); }
private void Form1_MouseDown(object sender, MouseEventArgs e) { n++; label1.Text += (n.ToString() + ":MouseDown,"); }
private void Form1_MouseUp(object sender, MouseEventArgs e) { n++; label1.Text += (n.ToString() + ":MouseUp,"); }
private void Form1_DoubleClick(object sender, EventArgs e) { n++; label1.Text += (n.ToString() + ":DoubleClick,"); }
|
|
|
|
|
|
|