I have a group box where I placed a CListCtrl with a custom height
m_FeatureList.GetClientRect(&rect); nColInterval = rect.Width()/2; m_FeatureList.InsertColumn(0, _T("ID"), LVCFMT_LEFT, nColInterval); m_FeatureList.InsertColumn(1, _T("Class"), LVCFMT_RIGHT, nColInterval); m_FeatureList.ModifyStyle( LVS_OWNERDRAWFIXED, 0, 0 ); m_FeatureList.SetExtendedStyle(m_CoilList.GetExtendedStyle() | LVS_EX_GRIDLINES); ... int a, b; m_FeatureList.GetItemSpacing(true, &a, &b); // data is a vector containing item text m_FeatureList.MoveWindow(listRect.left, listRect.top, listRect.Width(), b*data.size()+4); int i = 0; std::for_each(data.begin(), data.end(), [&](CString& p) { AddDefectListItem(i++,p); }); Now I want to place a picture control below the CListCtrl, but all the functions with CRect confuse me. All them place the control somewhere but not where I want.
//m_FeatureList.GetClientRect(&listRect); //m_FeatureList.ClientToScreen(&listRect); m_FeatureList.ScreenToClient(&listRect); // Oh my god, which coordinates do I need??? m_image.MoveWindow(listRect.left, listRect.bottom+3,listRect.Width(), 20); Can somebody help me with this crazy mfc stuff?
hWndin the parameter lists. If you find MFC confusing, read the Windows API documentation for the respective methods. Read About Windows to get the basics straight.