本帖最后由 microsft_apple 于 2012-08-15 12:21:35 编辑

解决方案 »

  1.   

    这个是我用API函数写的函数,里面的g_Image是个GDI+中的Image*对象。
    我是用它来半透明窗口的,你试试用在控件上行不行。
    void SetTransparent(HWND hWnd,UINT nTransparent)
    {
    BLENDFUNCTION Blend;
    HDC hdcMemory;
    int nBakWidth , nBakHeight;

    Blend.BlendOp=0;
    Blend.BlendFlags=0;
    Blend.AlphaFormat=1;
    Blend.SourceConstantAlpha=nTransparent;

    nBakWidth  =g_Image->GetWidth();
    nBakHeight =g_Image->GetHeight();

    HDC hdcTemp=GetDC(hWnd);
    hdcMemory=CreateCompatibleDC(hdcTemp);
    HBITMAP hBitMap=CreateCompatibleBitmap(hdcTemp,nBakWidth,nBakHeight);
    SelectObject(hdcMemory,hBitMap);

    RECT rect;
    GetWindowRect(hWnd,&rect);
    POINT ptWinPos={rect.left,rect.top};
    Graphics graph(hdcMemory);

    Point points[] = {Point(0, 0), Point(nBakWidth, 0),Point(0, nBakHeight)};
    graph.DrawImage(g_Image, points, 3); 

    SIZE sizeWindow={nBakWidth,nBakHeight};
    POINT ptSrc={0,0};

    UpdateLayeredWindow( hWnd,hdcTemp,&ptWinPos,&sizeWindow,hdcMemory,&ptSrc,0,&Blend,2);

    graph.ReleaseHDC(hdcMemory);
    ::ReleaseDC(hWnd,hdcTemp);
    hdcTemp=NULL;
    DeleteObject(hBitMap);
    DeleteDC(hdcMemory);
    DeleteDC(::GetDC(hWnd));
    hdcMemory=NULL;
    }
      

  2.   

    http://www.codeproject.com/KB/dialog/PerfectTranlucentDlg.aspx只使用一个窗体也可以,但不支持ActiveX控件(如WebBrowser Control, Flash Control)
      

  3.   

    UpdateLayeredWindow能显示子控件,你只要将子控件的WM_PAINT所绘制的图像AlphaBlend到目标图层就可以了。
      

  4.   

    分层窗口(LayeredWindow)系统不再绘制窗口和子控件,只能你自己绘制子控件或者弄两个窗口叠在一起.
    参考:http://blog.csdn.net/cometnet/article/details/6561912