Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Cancel procedure called by right mouse click event with right mouse click event

$
0
0

Hello:

The procedure below runs when I click the right button on my mouse. The procedure runs fine, it places a with border around my button. What I want to accomplish is when the user clicks the right mouse again, the weight is set to 0 and the border to none. However, it sets the border just fine, but when I press the right button again it does not reset my border. I am not sure what I am doing wrong.

Here is my code:

    Private Sub btnEmployeeDashboard_MouseDown(ByValsender As Object, ByVal myButton As System.Windows.Forms.MouseEventArgs) Handles btnEmployeeDashboard.MouseDown

        Dim ButtonClicked As Boolean = False

        If myButton.Button = MouseButtons.Right Then

            If ButtonClicked Then

                btnEmployeeDashboard.Border.Weight = 0
                ButtonClicked = False

            Else

                btnEmployeeDashboard.Border.ColorIndex = 2
                btnEmployeeDashboard.Border.Weight = 4
                ButtonClicked = True
            End If



        End If

    End Sub


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>