本文介绍了整个表格的Hittest透明性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在不调整表单可见性的情况下使表单的整个边界保持透明?

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

我正在使用对WindowFromPoint的user32 api调用,以便在鼠标下找到控件.在某些情况下,我想忽略浮动在主表单(或另一个子表单)前面的子表单的存在,但是要保留此表单以使其不可见.

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.

将表单的不透明度"设置为"0"将成功使命中测试直接通过它,但是表单显然是不可见的,我希望它保持可见.

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.

由于此子窗体上可以具有任意数量的控件,因此该窗体是否有办法拦截所有发送到该窗体上的子控件的WM_NCHITTEST消息,以便我可以为每个控件返回hittest透明性?表单中包含的控件是任意的,因此我无法在内部对其进行修改.

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.

推荐答案

您正在寻找WS_EX_TRANSPARENT Windows样式.

You are looking for the WS_EX_TRANSPARENT Windows Style.

此答案提供了充分的解释.

这篇关于整个表格的Hittest透明性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 13:07
查看更多