自定义panel的双击事件
简介:
private DateTime mLastClickTime;
this.mLastClickTime = Convert.ToDateTime("2013-01-01 00:00:00.
- private DateTime mLastClickTime;
- this.mLastClickTime = Convert.ToDateTime("2013-01-01 00:00:00.0000");
-
- private void setPnlMouseDown_Handler(object sender, MouseEventArgs e)
- {
- if (e.Button == System.Windows.Forms.MouseButtons.Left)
- {
- TimeSpan s = new TimeSpan();
- s = System.DateTime.Now - mLastClickTime;
- // 毫秒级比较
- if (s.Milliseconds 500)
- {
- setPnlMouseDoubleClick_Handler(sender, e);
- }
- else
- {
- this.mLastClickTime = DateTime.Now;
- }
- }
- }