闲闲流水

mfc中的透明窗体的设置

Using Layered Windows

To have a dialog box come up as a translucent window, first create the dialog as usual. Then, on WM_INITDIALOG, set the layered bit of the window's extended style and callSetLayeredWindowAttributes with the desired alpha value. The code might look like this:

 
// Set WS_EX_LAYERED on this window
SetWindowLong(hwnd,
              GWL_EXSTYLE,
              GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
 
// Make this window 70% alpha
SetLayeredWindowAttributes(hwnd, 0, (255 * 70) / 100, LWA_ALPHA);

SetLayeredWindowAttributes函数是全局api函数,需要在前面加::

上面来自于MSDN。

posted on 2013-03-14 21:06  闲闲流水  阅读(277)  评论(0编辑  收藏  举报

导航