visual-c++mfcsdiclistbox

resize issue CListBox inside SDI application with CWnd derived child


I am having a problem with the size of the CListBox that is suppose to cover all the client area of the SDi application.

My Main Window looks as shown below:

picture

As you can clearly see that the list box does not cover the whole client area. The following is what I am doing in on size of the CWnd derived class:

void CLogWnd::OnSize(UINT nType, int cx, int cy)
{
    CWnd::OnSize(nType, cx, cy);

    m_pWndLogList->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOMOVE | SWP_NOZORDER);
}

CLogWnd is the main window that fill all the area of the CMainFrame.


Solution

  • Give your listbox LBS_NOINTEGRALHEIGHT style. Without it, the box wants to have a height that's an exact multiple of a row height.