471,318 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

MouseEventArgs and a Clicks property

Hi,

I'm working on control that uses a MonthCalendar.
A MonthCalendar have not a DoubleClick event, so
i tried to use the events related with MouseEventArgs
parameter. I was trying to check "Clicks" property, but
it returns always 1.
Is there any chance to get "Clicks" greater than one?

Thanks in advance.
--
Marcin Grzębski
mg*******@taxussi.no.com.spam.pl
Feb 15 '06 #1
3 4832
Hi
Here is a solution from post:
http://groups.google.com/group/micro...1f442f376022d9

Try this: (assumes a monthcalendar control called MonthCalendar1 and a
textbox control called TextBox1)

Private m_NumClicks As Short = 0
Private m_FirstClick As Long

Private Sub MonthCalendar1_DateSelected( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.DateRangeEventArgs) _
Handles MonthCalendar1.DateSelected

If m_NumClicks >= 2 Then
TextBox1.Text = e.Start.Date.ToString
m_NumClicks = 0
End If

End Sub

Private Sub MonthCalendar1_MouseDown( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles MonthCalendar1.MouseDown

If e.Button = MouseButtons.Left Then
If m_NumClicks = 0 Then
m_FirstClick = Now.Ticks
m_NumClicks += 1
ElseIf (Now.Ticks - m_FirstClick) > 2000000 Then
m_NumClicks = 0
Else
m_NumClicks += 1
End If
End If
End Sub
Jacob Grass
Microsoft .NET MVP

Feb 15 '06 #2
Hi,

Thank You very much!

Marcin

AH****@gmail.com wrote:
Hi
Here is a solution from post:
http://groups.google.com/group/micro...1f442f376022d9

Try this: (assumes a monthcalendar control called MonthCalendar1 and a
textbox control called TextBox1)

Private m_NumClicks As Short = 0
Private m_FirstClick As Long

Private Sub MonthCalendar1_DateSelected( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.DateRangeEventArgs) _
Handles MonthCalendar1.DateSelected

If m_NumClicks >= 2 Then
TextBox1.Text = e.Start.Date.ToString
m_NumClicks = 0
End If

End Sub

Private Sub MonthCalendar1_MouseDown( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles MonthCalendar1.MouseDown

If e.Button = MouseButtons.Left Then
If m_NumClicks = 0 Then
m_FirstClick = Now.Ticks
m_NumClicks += 1
ElseIf (Now.Ticks - m_FirstClick) > 2000000 Then
m_NumClicks = 0
Else
m_NumClicks += 1
End If
End If
End Sub
Jacob Grass
Microsoft .NET MVP

--
Marcin Grzębski
mg*******@taxussi.no.com.spam.pl
Feb 15 '06 #3
Your Welcome

Feb 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by JH | last post: by
1 post views Thread by Rob Schoenaker | last post: by
7 posts views Thread by Ramsi | last post: by
5 posts views Thread by Sam | last post: by
1 post views Thread by Badass Scotsman | last post: by
4 posts views Thread by Peted | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.