WS_EX_TRANSPARENT - What does it actually do?

后端 未结 2 1609
难免孤独
难免孤独 2020-12-03 20:00

In my project, I create a form with the opacity controlled by the user. If the form was fully transparent the mouse events \'fell through\' (without my intervention), otherw

2条回答
  •  被撕碎了的回忆
    2020-12-03 20:28

    WS_EX_TRANSPARENT makes your events (like mouse clicks) fall through your window, amongst other things. Opacity is a separate concept, it instructs window manager to apply alphablending when drawing your form. Those two things are not related, but when you combine them you get the effect you need in your case.

    So:

    1. Paint method of your form is called normally as it should, opacity has nothing to do with it.

    2. Opacity does not have anything to do with mouse events, as described in the first paragraph.

提交回复
热议问题