如何在一个窗口中生成一个透明的矩形框?

解决方案 »

  1.   

    用层窗口
    SetLayeredWindowAttribute 或 UpdateLayeredWindow 函数
      

  2.   

    呵呵,我刚从某人里面的文章看到这个.以下是代码
    -------------------------------------------
    //加入WS_EX_LAYERED扩展属性,必须要加上这个属性
    SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,
    GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);//调用User32.DLL中的函数
    HINSTANCE hInst = LoadLibrary("User32.DLL"); 
    if(hInst) 

       typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD); 
       MYFUNC fun = NULL;
       //取得SetLayeredWindowAttributes函数指针 
    fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
    if(fun)fun(this->GetSafeHwnd(),0,215,2); 
    FreeLibrary(hInst); 
    }