Beispiel #1
0
HRESULT FMPlayerDShow::SetVideoRect(const RECT &rcPos)
{
	HRESULT hr = S_FALSE; 

	WTL::CRect wr = rcPos; 

	m_VideoRect = rcPos; 
	if (m_VideoWnd)
	{

		WTL::CSize arxy = GetVideoSize(); 
		WTL::CRect vr = WTL::CRect(0,0,0,0);
		WTL::CSize ws = wr.Size(); 

		int w = ws.cx;
		int h = ws.cy;

		double m_ZoomX = 1; 
		double m_ZoomY = 1; 
		double m_PosX = 0.5; 
		double m_PosY = 0.5; 

		BOOL bFromInside = TRUE;  

		if(bFromInside)
		{
			h = ws.cy;
			w = MulDiv(h, arxy.cx, arxy.cy);

			if(bFromInside && w > ws.cx)
			{
				w = ws.cx;
				h = MulDiv(w, arxy.cy, arxy.cx);
			}
		}

		WTL::CSize size((int)(m_ZoomX*w), (int)(m_ZoomY*h));

		WTL::CPoint pos(
			(int)(m_PosX*(wr.Width()*3 - m_ZoomX*w) - wr.Width()), 
			(int)(m_PosY*(wr.Height()*3 - m_ZoomY*h) - wr.Height()));


		vr = WTL::CRect(pos, size);

		wr |= WTL::CRect(0,0,0,0);
		vr |= WTL::CRect(0,0,0,0);

		{

			hr = m_pBV->SetDefaultSourcePosition();
			hr = m_pBV->SetDestinationPosition(vr.left, vr.top, vr.Width(), vr.Height());
			hr = m_VideoWnd->SetWindowPosition(wr.left, wr.top, wr.Width(), wr.Height());


		}
	}

	return hr; 
}
Beispiel #2
0
LRESULT QFrame::OnHtmlNotify( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    switch(((NMHDR*)lParam)->code) 
    {
    case HLN_DOCUMENT_COMPLETE:
        {
            if ( !_HasFlag(GetStyle(),WS_CHILD) )
            {
                WTL::CRect r;
                GetWindowRect(&r);

                // 非子窗口,调整窗体为合适大小
                int nWidth = max(HTMLayoutGetMinWidth(m_hWnd), (UINT)r.Width()); 
                WTL::CRect rcNew;
                rcNew.SetRect(r.left, r.top, 
                    nWidth + r.left, 
                    r.top + max((UINT)r.Height(), HTMLayoutGetMinHeight(m_hWnd,nWidth)));
                AdjustWindowRectEx( &rcNew, GetStyle(), FALSE, GetExStyle());

                // 调整大小,位置不变
                SetWindowPos(NULL, 0, 0, rcNew.Width(), rcNew.Height(), SWP_NOZORDER | SWP_NOMOVE);

                size_min_ = rcNew.Size();
                // 设置title
                ctl_title_ = GetCtrl("#wc-title");
                if (ctl_title_.is_valid())
                {
                    SetWindowText(ctl_title_.GetText());
                }
            }
            break;
        }
    }
    return QView::OnHtmlNotify(uMsg, wParam, lParam);
}