VC 窗口透明化

来源:互联网 发布:淘宝商城女装新款上衣 编辑:程序博客网 时间:2024/05/19 20:57
//ModifyStyleEx(0, WS_EX_LAYERED|WS_EX_TRANSPARENT);  //窗口透明并且不接受鼠标消息ModifyStyleEx(0, WS_EX_LAYERED);  //窗口透明但接受鼠标消息SetLayeredWindowAttributes(0, 128, 2);  //第二个参数表示透明度//SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);


以下信息来自MSDN

 

CWnd::SetLayeredWindowAttributesVisual Studio 2010

Sets the opacity and transparency color key of a layered window.

BOOL SetLayeredWindowAttributes(   COLORREF crKey,   BYTE bAlpha,   DWORD dwFlags);
BOOL SetLayeredWindowAttributes(   COLORREF crKey,   BYTE bAlpha,   DWORD dwFlags);
Parameters
crKey

Pointer to a                    COLORREF value that specifies the transparency color key to be used when composing the layered window. All pixels painted by the window in this color will be transparent. To generate a                   COLORREF, use the RGB macro.                

bAlpha

Alpha value used to describe the opacity of the layered window. For more information, see the                   SourceConstantAlpha member of the                    BLENDFUNCTION structure. When                    bAlpha is 0, the window is completely transparent. When                   bAlpha is 255, the window is opaque.                

dwFlags

Specifies an action to take. This parameter can be one or more of the following values. For a list of possible values, see                  SetLayeredWindowAttributes.                

Return Value

Nonzero if the function succeeds; otherwise 0.

Remarks

This member function emulates the functionality of the function               SetLayeredWindowAttributes, as described in the Windows SDK.

 

0 0
原创粉丝点击