Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15762

VS 2019 How get location of control during OnControlAdded?

$
0
0
I'm trying to work around the problem, of not being able to reparent a control to its GrandParent in Design-mode.
I want to add control_A to control_B, while control_A is covered by its child; control_C.
So I set AllowDrop = False on control_C, so control_A drops through and parents to Control_B.
But I still have to know on witch child, contol_A would have dropped.
To get the position of Control_A, I call OnControlAdded of Control_B:
Code:

  Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
        MsgBox(e.Control.Location.X)
        MsgBox(e.Control.Location.Y)
    End Sub

X and Y are always zero.
Though control_A is added somewhere else.
Is the "drop"location of a control saved in some variable and used later?

Viewing all articles
Browse latest Browse all 15762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>