C# How to perform an action if right mouse button is clamped?

You need to perform an action label.text = "Pressed"
If right mouse button is clamped and the cursor is over the element.
June 14th 19 at 19:00
1 answer
June 14th 19 at 19:02
If you need to control over a specific element, then you need the MouseDown event.
This event is almost all of the UI kontrolov. Just sign up for it ( on MouseUp, too, for the opposite action).
Additionally, you can look here - https://msdn.microsoft.com/ru-ru/library/system.wi...

If you need globally (no matter what the item, simply to understand down any mouse button) - there is a library, https://github.com/gmamaladze/globalmousekeyhook . There is an example.
I need to see if the PictureBox is clamped over it to be the cursor, execute the output from the program. At the moment I did so

check = false
if PictureBox.Down, check the variable = true
if PictureBox.Up, then exit the program

And check if the variable = true then do the red button

If not, what not to do
But if I hold the button and the cursor moves off the button it
anyway, the program is ended and I do not need. I have the program completed only if the cursor is within the bounds of the button. - terrance.Bechtelar commented on June 14th 19 at 19:05

Find more questions by tags C#Windows Forms