近期准备写一个 关于 Layerwindow的专题文章

经常被问到 如何制作 PNG 那样的 半透明窗口,所以计划近期准写一个 关于 Layerwindow的专题文章。
其实大致原理是这样:
把PNG 转成 32 bit 的 bitmap,然后
就是call  UpdateLayyerWindow api,传对参数就可以了。
 
待续,coming soon!

void CUIPngWnd::Render()
{
CRect rcWindow;
GetWindowRect(rcWindow);

if(m_BmpAlpha.IsNull()) return ;

CRect rcWindowNew = rcWindow;

  //HBITMAP hBmpNew = GetNewBmp(rcWindowNew);
HBITMAP hBmpNew = m_BmpAlpha.GetAlphaBmp();    // PNG to 32 bitmap
  if ( NULL == hBmpNew )
  return ;

CWindowDC dcClient(m_hWnd);
CDC memDC;
memDC.CreateCompatibleDC(dcClient);
HBITMAP hBitmapOld = memDC.SelectBitmap(hBmpNew);

CPoint ptDest(rcWindowNew.left,rcWindowNew.top);
CPoint ptSrc(0,0);
CSize szWin(rcWindowNew.Width(),rcWindowNew.Height());
BLENDFUNCTION stBlend = { 0/*AC_SRC_OVER*/, 0, 255/*1..255*/, 1/*AC_SRC_ALPHA=1*/ };
::UpdateLayeredWindow(m_hWnd,NULL,&ptDest,&szWin,memDC,&ptSrc,0,&stBlend,0x00000002); 
memDC.SelectBitmap(hBitmapOld);
//DeleteObject(hBmpNew);
}

UpdateLayeredWindow  自然会变成 异性窗口了。
 
下图 就是demo的例子。
 
This entry was posted in 技术开发. Bookmark the permalink.

19 Responses to 近期准备写一个 关于 Layerwindow的专题文章

  1. Jonay says:

    That’s a sutlbe way of thinking about it.

  2. Nevaeh says:

    This is the pferect way to break down this information.

  3. xafskycnxjm says:

    yPmTWJ , [url=http://giynpqursxxl.com/]giynpqursxxl[/url], [link=http://sbdbtubnzqtq.com/]sbdbtubnzqtq[/link], http://xxkcfpuxigcr.com/

  4. lyryokuch says:

    SQbLU4 , [url=http://rhoispfzsmnk.com/]rhoispfzsmnk[/url], [link=http://hvshtuvqyzwy.com/]hvshtuvqyzwy[/link], http://omlofpjuwnyr.com/

  5. Good site you have here.. It’s difficult to find good quality writing like yours nowadays. I honestly appreciate people like you! Take care!!

  6. Pingback: low vitamin d

  7. Pingback: dating

  8. Pingback: in

  9. Pingback: facebook of sex

  10. Pingback: facebook sex .com

  11. Pingback: Facebook of Sex

  12. Pingback: free sex ads

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>