z 顺序更改时 Winform 控制事件
Winform controls event when z order changed
我在同一个地方有控件(一个在另一个上面)
有没有办法在 z 顺序更改时获取事件?
目的是为了调试看什么时候谁改了顺序
可以通过BringToFront
or SendToBack
or SetChildIndex
改变
喜欢Control.ZOrderChanged
或form.Controls.ZOrderChanged
更改 ChildIndex 将触发 Layout Event on the control that is parent to the child control. Of course this assumes that SuspendLayout has not been called on the parent control.
您可以通过勾选 LayoutEventArgs.AffectedProperty Property (a string) to see if it is equal to "ChildIndex". To determine which control triggered the event, check the LayoutEventArgs.AffectedControl Property
来过滤事件
我在同一个地方有控件(一个在另一个上面)
有没有办法在 z 顺序更改时获取事件?
目的是为了调试看什么时候谁改了顺序
可以通过BringToFront
or SendToBack
or SetChildIndex
喜欢Control.ZOrderChanged
或form.Controls.ZOrderChanged
更改 ChildIndex 将触发 Layout Event on the control that is parent to the child control. Of course this assumes that SuspendLayout has not been called on the parent control.
您可以通过勾选 LayoutEventArgs.AffectedProperty Property (a string) to see if it is equal to "ChildIndex". To determine which control triggered the event, check the LayoutEventArgs.AffectedControl Property
来过滤事件