zoukankan      html  css  js  c++  java
  • 【MFC】半透明对话框(转)

    原文转自 http://jingyan.baidu.com/article/656db918fd5b0ee381249ca1.html

    在OnInitDialog()函数添加以下代码:

        //设置半透明对话框
        SetWindowLong(this->GetSafeHwnd(), GWL_EXSTYLE, GetWindowLong(this->GetSafeHwnd(), GWL_EXSTYLE) ^ 0x80000);
        HINSTANCE hInst = LoadLibrary("User32.DLL");  //加载库文件
        if (hInst)
        {
            typedef BOOL(WINAPI *MYFUNC)(HWND, COLORREF, BYTE, DWORD);
            MYFUNC func = NULL; //函数指针
            //取得SetLayeredWindowAttributes函数指针 
            func = (MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
            //使用SetLayeredWindowAttributes函数设定透明度
            if (func)func(this->GetSafeHwnd(), RGB(0, 0, 0), 200, 0x2);
            FreeLibrary(hInst);
        }
  • 相关阅读:
    [HNOI2008] Cards
    loj #136
    a problem
    dp * 3
    STL
    套题1
    luogu 4211
    loj #2319
    loj #2316
    luogu 1144
  • 原文地址:https://www.cnblogs.com/happykoukou/p/5969957.html
Copyright © 2011-2022 走看看