Hittest transparency for an entire form

允我心安 提交于 2019-12-12 04:59:03

问题


Is it possible for the entire bounds of a form to be hittest transparent without adjusting the visibility of the form?

I am using a user32 api call to WindowFromPoint in order to find the control under the mouse. In some circumstances I would like to ignore the existance of a child form that floats in front of the main form (or another child form), but keep this form to ignore visible.

Setting the Opacity of the form to ignore to 0 will successfully cause the hittest to pass straight through it, but the form obviously is invisible, and I'd prefer it to remain visible.

Since this child form can have any arbitrary number of controls on it, is there a way for this form intercept all WM_NCHITTEST messages going to child controls on the form so that I can return hittest transparency for each control? The controls contained on the form are arbitrary so I am unable to modify them internally.


回答1:


You are looking for the WS_EX_TRANSPARENT Windows Style.

This answer gives a good-enough explanation.



来源:https://stackoverflow.com/questions/11064302/hittest-transparency-for-an-entire-form

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