2

現在フォーカスのあるウィンドウが完全に私のクライアント rect に表示されている場合に機能する関数を作成しようとしていますが、私CScrollViewが間違っていることを解決するのに苦労しています。これは私がこれまでに持っているものです:

CWnd * pWnd = pView->GetFocus();
if(pWnd)
{                               
    CRect winRect;
    pWnd->GetWindowRect(&winRect);
    pView->ScreenToClient(&winRect);    //pView is a pointer the CScrollView        

    CRect viewRect;
    pView->GetClientRect(&viewRect);

    CPoint currentScrollPoint = pView->GetScrollPosition();
    viewRect.OffsetRect(currentScrollPoint);

    if(!(viewRect.PtInRect(winRect.BottomRight()) && viewRect.PtInRect(winRect.TopLeft())))
    {
        //Not shown fully
    }
}

ここで私が間違っていることを誰かが見たり、これを行うためのより良い方法を提案したりできますか?

4

1 に答える 1