Пример #1
0
void CMenuWndHook::OnPrint(HDC dc)
{
    if(m_strSkinName.IsEmpty()) return;
    ISkinObj *pSkin=GETSKIN(m_strSkinName);
    if(!pSkin) return;
    SSkinImgFrame *pBorderSkin=static_cast<SSkinImgFrame*>(pSkin);
    if(!pBorderSkin) return;

    CRect rcClient;
    GetClientRect(m_hWnd,&rcClient);
    ClientToScreen(m_hWnd,(LPPOINT)&rcClient);
    ClientToScreen(m_hWnd,((LPPOINT)&rcClient)+1);
    CRect rcWnd;
    GetWindowRect(m_hWnd, &rcWnd);
    rcClient.OffsetRect(-rcWnd.TopLeft());
    
    int nSave = ::SaveDC(dc);
    ::ExcludeClipRect(dc,rcClient.left,rcClient.top,rcClient.right,rcClient.bottom);
    rcWnd.MoveToXY(0,0);
    
    CAutoRefPtr<IRenderTarget> pRT;
    GETRENDERFACTORY->CreateRenderTarget(&pRT,rcWnd.Width(),rcWnd.Height());
    pBorderSkin->Draw(pRT,rcWnd,0);
    HDC hmemdc=pRT->GetDC(0);
    ::BitBlt(dc,0,0,rcWnd.Width(),rcWnd.Height(),hmemdc,0,0,SRCCOPY);
    pRT->ReleaseDC(hmemdc);
    ::RestoreDC(dc,nSave);
}
Пример #2
0
void CMenuWndHook::OnWindowPosChanging(WINDOWPOS *pWindowPos)
{
    if(m_strSkinName.IsEmpty()) return;
    ISkinObj *pSkin=GETSKIN(m_strSkinName);
    if(!pSkin || !pSkin->IsClass(SSkinImgFrame::GetClassName())) return;
    SSkinImgFrame *pBorderSkin=static_cast<SSkinImgFrame*>(pSkin);
    if(!pBorderSkin) return;
    pWindowPos->cx += pBorderSkin->GetMargin().left+pBorderSkin->GetMargin().right-SM_CXMENUBORDER*2;
    pWindowPos->cy += pBorderSkin->GetMargin().top+pBorderSkin->GetMargin().bottom-SM_CXMENUBORDER*2;
}
Пример #3
0
 HRESULT SImageMaskWnd::OnAttrImage(const SStringW & strValue,BOOL bLoading)
 {
     if(m_bmpCache)
     {
         ISkinObj * pSkin = GETSKIN(strValue);
         if(pSkin) MakeCacheApha(pSkin);
     }else
     {
         m_strSkin = strValue;
     }
     return bLoading?S_OK:S_FALSE;
 }
Пример #4
0
void CMenuWndHook::OnNcCalcsize(BOOL bValidCalc,NCCALCSIZE_PARAMS* lpncsp)
{
    if(m_strSkinName.IsEmpty()) return;
    ISkinObj *pSkin=GETSKIN(m_strSkinName);
    if(!pSkin || !pSkin->IsClass(SSkinImgFrame::GetClassName())) return;
    SSkinImgFrame *pBorderSkin=static_cast<SSkinImgFrame*>(pSkin);
    if(!pBorderSkin) return;

    lpncsp->rgrc[0].left=lpncsp->lppos->x+pBorderSkin->GetMargin().left;
    lpncsp->rgrc[0].top=lpncsp->lppos->y+pBorderSkin->GetMargin().top;
    lpncsp->rgrc[0].right=lpncsp->lppos->x+lpncsp->lppos->cx-pBorderSkin->GetMargin().right;
    lpncsp->rgrc[0].bottom=lpncsp->lppos->y+lpncsp->lppos->cy-pBorderSkin->GetMargin().bottom;
}