Get control at cursor position

pettrer

Well-known member
Joined
Sep 5, 2008
Messages
92
Programming Experience
10+
Hi,

I'm trying to access a panel at the mouse position, like this:

VB.NET:
Private Sub pSalar_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles pSalar.MouseDown

My problem is that this panel is the parent of labels, and when I click somewhere on the panel, I can't get it to trigger the event. If I remove the line below, it works ok (but then obviously it's not holding any children labels anymore):

VB.NET:
pSalartemp.Parent = pSalar

(The panel called pSalartemp holds all the labels temporaily so that I don't have to draw the panel before the list of lables is filled.)

So basically I can see the panel in front of me, but the mousedown event - or any mouserelated venet for that matter - won't recognise it as long as it has children.

How do I do it?

Thanks a lot,

Pettrer
 
Back
Top