dui-layered windows two modes (SetLayeredWindowAttributes and Updatelayeredwindow two methods each have pros and cons)

Source: Internet
Author: User

The Layeredwindow is available in two different modes:

1. Use SetLayeredWindowAttributes to set the transparency, complete the window's unified transparency, the window still receives the paint message, other applications like normal window.

2. Using the Updatelayeredwindow method, to the system to submit a DC containing bitmap, to the system unified management, at this time no longer receive the paint message, any changes to the window can only be modified by Updatelayeredwindow.

If you don't need to have different transparency for the pixel level, just use the setlayeredwindowattributes mode, as with normal window usage, the system caches the bitmap of the window, so when the other windows on the window are moved away, This is where the system will go to draw itself and will not send the paint message. With the benefit of this pattern, you basically don't have to change the way you use the window, and after you receive the paint message, the drawn image is redirected to another function, which is combined to get a transparent effect.

If you need to achieve different levels of transparency for the pixel level, or if you want to control the drawing of the window more directly, you must use the Updatelayeredwindow method, which does not redirect your drawing results, nor does it cache the window's bitmap, but it is entirely up to you to draw, This is more efficient in terms of memory.

1. Once you call the Setlayeredwindowattributes,updatelayeredwindow call will fail, you need to reset the ws_ex_layered, which is the key to the two mode switching. The 2.ws_ex_layered property is not set to child Windows 3. In a completely transparent place, the mouse click will be passed through, and if the Ws_ex_transparent property is set on the window, the mouse message will also pass through

The DM uses the following method to implement the Updatelayeredwindow window to receive the paint message:

Http://hgy413.com/1865.html

dui-layered windows two modes (SetLayeredWindowAttributes and Updatelayeredwindow two methods each have pros and cons)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.