MFC Dialog 透明渐变

    //以下在DialogInit消息中写
SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,    GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000); this->SetTimer(245,100,NULL);
void CLayerWndDlg::OnTimer(UINT_PTR nIDEvent)
{
    // TODO: 在此添加消息处理程序代码和/或调用默认值
    static int i = 0;
    if(nIDEvent == 245)
    {
        SetLayeredWindowAttributes(0,i,2);
        i+=10;
        if(i == 250)
        {
            SetLayeredWindowAttributes(0,255,2);    
            this->KillTimer(nIDEvent);
        }
    }
    CDialogEx::OnTimer(nIDEvent);
}

 

posted @ 2012-12-10 21:47  瓜蛋  阅读(862)  评论(0编辑  收藏  举报