模仿酷狗7(Kugou7)音乐魔方界面源码

源码名称:模仿酷狗7(Kugou7)界面源码

源码作者:邓学彬(泪闯天涯)

源码说明:内含VC++源码、易语言源码各一份.包含所有图片源码(使用Fireworks编辑)

开发环境:VC版--VS2005、Gdiplus;易语言版--易语言5,无模块

实现方法:给窗口加上WS_EX_LAYERED样式,使用Gdiplus画出图片,然后UpdateLayeredWindow。处理WM_MOUSEHOVER、WM_MOUSELEAVE消息,鼠标进入或移出画出不同状态。

注意事项:只是实现初步模仿而已,未响应子控件操作,如果大家有兴趣就接着完善吧。

模仿酷狗7(Kugou7)音乐魔方界面源码

 

主要源码:

void CKugouUIDlg::DrawUI(void)  
{  
    HDC hDC=::GetDC(m_hWnd);  
    HDC hMemDC=::CreateCompatibleDC(hDC);  
    BITMAPINFO bitmapinfo;  
    bitmapinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);  
    bitmapinfo.bmiHeader.biBitCount = 32;  
    bitmapinfo.bmiHeader.biHeight = m_KugouUI.height;  
    bitmapinfo.bmiHeader.biWidth = m_KugouUI.width;  
    bitmapinfo.bmiHeader.biPlanes = 1;  
    bitmapinfo.bmiHeader.biCompression=BI_RGB;  
    bitmapinfo.bmiHeader.biXPelsPerMeter=0;  
    bitmapinfo.bmiHeader.biYPelsPerMeter=0;  
    bitmapinfo.bmiHeader.biClrUsed=0;  
    bitmapinfo.bmiHeader.biClrImportant=0;  
    bitmapinfo.bmiHeader.biSizeImage = bitmapinfo.bmiHeader.biWidth * bitmapinfo.bmiHeader.biHeight * bitmapinfo.bmiHeader.biBitCount / 8;  
    HBITMAP hBitmap=::CreateDIBSection (hMemDC,&bitmapinfo, 0,NULL, 0, 0);  
    HBITMAP hOldBitmap = (HBITMAP)::SelectObject (hMemDC,hBitmap);  
    Graphics g(hMemDC);  
    //画出各个界面元素----------------------  
    DrawItem(&g,m_KugouUI.left);  
    DrawItem(&g,m_KugouUI.top);  
    DrawItem(&g,m_KugouUI.right);  
    DrawItem(&g,m_KugouUI.bottom);  
    DrawItem(&g,m_KugouUI.main);  
    for(int i=0;i<4;i++)  
        DrawItem(&g,m_KugouUI.Item[i]);   
    //设置透明窗口-------------------------------------------------  
    CPoint DestPt(0,0);  
    CSize psize(m_KugouUI.width,m_KugouUI.height);  
    BLENDFUNCTION blendFunc32bpp;  
    blendFunc32bpp.AlphaFormat = AC_SRC_ALPHA;  
    blendFunc32bpp.BlendFlags = 0;  
    blendFunc32bpp.BlendOp = AC_SRC_OVER;  
    blendFunc32bpp.SourceConstantAlpha = 255;  
    ::UpdateLayeredWindow(m_hWnd,hDC,NULL,&psize,hMemDC,&DestPt,0,&blendFunc32bpp,ULW_ALPHA);  
    //释放资源-------------------------------------------------  
    ::SelectObject (hMemDC,hOldBitmap);  
    ::DeleteObject(hBitmap);  
    ::DeleteDC(hMemDC);  
    ::ReleaseDC(m_hWnd,hDC);  
}

源码下载:

CSDN下载:http://download.csdn.net/source/3386452 (需要1积分)

易语言论坛下载:http://bbs.eyuyan.com/read.php?tid=269124 (需要注册登录)

源码爱好者下载:http://www.codefans.net/soft/13933.shtml (可直接下载)

 

你可能感兴趣的:(图形图像,C++/VC++/MFC,界面美化,自绘,酷狗)