html仿酷狗⾳乐界⾯代码,模仿酷狗7(Kugou7)⾳乐魔⽅界⾯
源码
源码名称:模仿酷狗7(Kugou7)界⾯源码
源码作者:邓学彬(泪闯天涯)
源码说明:内含VC++源码、易语⾔源码各⼀份.包含所有图⽚源码(使⽤Fireworks编辑)
开发环境:VC版--VS2005、Gdiplus;易语⾔版--易语⾔5,⽆模块
实现⽅法:给窗⼝加上WS_EX_LAYERED样式,使⽤Gdiplus画出图⽚,然后UpdateLayeredWindow。处理WM_MOUSEHOVER、WM_MOUSELEAVE消息,⿏标进⼊或移出画出不同状态。
注意事项:只是实现初步模仿⽽已,未响应⼦控件操作,如果⼤家有兴趣就接着完善吧。
主要源码:
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,p);
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);
}
源码下载:

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。