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