Transparent hwnd window

前端 未结 2 1333
被撕碎了的回忆
被撕碎了的回忆 2021-01-07 12:28

Is it possible to create a \"transparent\" hwnd window ? What I mean by that is that there is no background or borders of that window but that only text is visible...like if

相关标签:
2条回答
  • 2021-01-07 12:43

    From your tag of hwnd, I'm assuming that you are working with C++ or at least have access to the Win32 API, there are plenty of resources to help you get started. The concept is called Window Compositing.

    Transparent win32 window and text

    Quick and Dirty Window Transparency

    If you use WPF instead of C++, here's a link: Transparent Windows in WPF

    0 讨论(0)
  • 2021-01-07 12:44

    On Windows 2000 and later, you can create a top-level window with the WS_EX_LAYERED style (on Windows 8 and later, child windows can now use the WS_EX_LAYERED style as well), and then use SetLayeredWindowAttributes() or UpdateLayeredWindow() to make the window transparent.

    Create a solid background color, and then set that color as the window's transparent color. Anything on the window that is not using that color will not be transparent. The OS will handle the rest for you.

    Refer to MSDN for more details:

    • Layered Windows
    • Using Layered Windows
    • SetLayeredWindowAttributes()
    • UpdateLayeredWindow()
    0 讨论(0)
提交回复
热议问题