C
C#2mo ago
FloW

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?
No description
12 Replies
slezyradosti
slezyradosti2mo ago
"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
leowest
leowest2mo ago
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
FloW
FloW2mo ago
no , the problem is that grey panel on the left and on the top somehow counts as form
leowest
leowest2mo ago
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
FloW
FloW2mo ago
then why do they do what they are not supposed to?
leowest
leowest2mo ago
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
leowest
leowest2mo ago
No description
leowest
leowest2mo ago
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
leowest
leowest2mo ago
leowest
leowest2mo ago
as u can see when I mousedown white it shows a messagebox when I do on blue nothing happens
leowest
leowest2mo ago
this might be easier to understand
leowest
leowest2mo ago
the mouse position is only tracked when moving on the white panel
Want results from more Discord servers?
Add your server
More Posts