WinForms
The white field is form itself, and there is code for Form1.MouseDown. But as you can see there is also a Panel on the top and on the left. When Im clicking at these panels it also counts as Form1.MouseDown. What should I do to make it not happening?
12 Replies
"the white field is form itself" - everything there, is a from itself. That is why it counts as mousedown.
I didn't do it, but try to separate the area you want to handle it with mousedown by some tools that wininforms suggests you
so the issue here is that u want MouseDown only on the white area? then just use the panel of that area and add the event to it
You can select the specific panel and add the event specifically to it
instead of globaly on the top level form
no , the problem is that grey panel on the left and on the top somehow counts as form
no they dont
they count as controls
Form is the window itself that houses all the controls
if u put the event on the window
then why do they do what they are not supposed to?
then it will subject everything on it
its doing exactly what its supposed to
if u want the event on the panel then add the event on the panel not on the window
when u add event to Form1, that event spans on all controls
if u add control to the panel on the bottom right it will affect only that control
as u can see when I mousedown white it shows a messagebox when I do on blue nothing happens
this might be easier to understand
the mouse position is only tracked when moving on the white panel