How to prevent a control from changing Z order?

China☆狼群 提交于 2019-12-06 03:03:36

To prevent Z-order change you should catch WM_WINDOWPOSCHANGING message and set SWP_NOZORDER flag.

No an answer, but have you tried to go with he ControlDesigner instead of rolling your own deigner mode interaction?

Window dialogs manage tab order and focus through the controls windows' z-order, the control that is given focus is raised to the top.

If you want your custom control to retain its relative z-positioning, then ensure that its properties do not indicate its a TABSTOP or otherwise capable of receiving focus. i.e. will it work if disabled?

The flip side of this is, even if you successfullly stop your control's z-order from changing, its implicitly going to be re-positioned as the user interacts with other controls.

Are you sure it's the hit test that's causing the problem? How are you resizing the control? One option is to call SetWindowPos using p-invoke passing it SWP_NOZORDER flag.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!