Note that there are some explanatory texts on larger screens.

plurals
  1. POMouse Down event not being called on the second click
    text
    copied!<p>I have an application in which i'm drawing a line/square on a picturebox. I also need the user to click on a particular point on the picturebox(after drawing the square/line) so as to get the location of the second point. But the mouse down event does not work for the second click. My code is as shown:</p> <pre><code>Dim m_Drawing As Boolean 'm_Drawing = False Dim m_Startx As Single Dim m_Starty As Single Dim m_endx As Single Dim m_endy As Single Dim square_click As Boolean 'square_click = False Dim line_click As Boolean 'line_click = False Dim bclick As Boolean 'blick = True Dim startx As Single Dim starty As Single Dim endx As Single Dim endy As Single Dim laserx_mm As Single Dim lasery_mm As Single Dim rectx_mm As Single Dim recty_mm As Single Dim xpos As Single Dim ypos As Single Dim uxpos As Single Dim uypos As Single Dim dist As Single Dim dist1 As Single Private Sub Command1_Click() square_click = True End Sub Private Sub Command2_Click() line_click = True End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim diffx As Single Dim diffy As Single Picture1.Cls If m_Startx = 0 And m_Starty = 0 Then m_Startx = X m_Starty = Y 'End If startx = X starty = Y rectx_mm = X recty_mm = Y 'move to start position ElseIf m_Startx &lt;&gt; 0 And m_Starty &lt;&gt; 0 Then laserx_mm = X lasery_mm = Y diffx = rectx_mm - laserx_mm diffy = recty_mm - lasery_mm dist = xpos + (diffx / 4.74 / 1000) dist1 = ypos - (diffy / 4.68 / 1000) End If End Sub Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) endx = X endy = Y m_endx = X m_endy = Y If square_click = True Then Picture1.Line (m_Startx, m_Starty)-(endx, endy), vbWhite, B ElseIf line_click = True Then Picture1.Line (m_Startx, m_Starty)-(endx, endy), vbWhite End If End Sub </code></pre> <p>The Code: <code>ElseIf m_Startx &lt;&gt; 0 And m_Starty &lt;&gt; 0</code></p> <p>does not get executed unless and until i put a breakpoint there. I'm not sure why this is happening. Please help me out! Hope i was clear enough! Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload