케이피 2008. 5. 20. 01:20

4/25
 # "The view window is a child of the frame window"

 # 상태바
SetPaneText(int nIndex, LPCTSTR lpszNewText, BOOL bUpdate=TRUE);
MainFrame 포인터를 얻어 SetPaneText 때려야한다.
int idex = CommandToIndex(ID);  // 해당 페인 번호를 리턴

CMainFrame* pMfrm = (CMainFrame*)AfxGetApp()->m_pMainWnd; pDoc = (CMyAddressBookDoc*)pMfrm->GetActiveView()->GetDocument();


# 상태바 크기 조절... 은근히 쉽지 않은걸? ㅠ_ㅠ 구현 실패다...
String 길이에 따라 조절?
m_wndStatusBar.GetStatusBarCtrl().SetParts();

const int nParts = 4;
CRect rect;
m_wndStatusBarCtrl.GetClientRect(&rect);
int widths[nParts] = { rect.right-300, rect.right-200, rect.right-100, -1 };
VERIFY( m_wndStatusBarCtrl.SetParts(nParts, widths) );


# "윈도에는 어떤 자식 윈도든 삽입할 수 있다."


CListCtrl& listCtrl = GetListCtrl();
while((nItem = listCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)

# 한줄마다 다른 색을 넣기 위해...   Custom Draw를 써야한다...
 http://www.codeproject.com/listctrl/lvcustomdraw.asp         
ON_NOTIFY_REFLECT ( NM_CUSTOMDRAW, OnCustomdraw )

afx_msg void OnCustomdraw ( NMHDR* pNMHDR, LRESULT* pResult );

void CMyDlg::OnCustomdraw ( NMHDR* pNMHDR, LRESULT* pResult )
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast( pNMHDR );

    // Take the default processing unless we set this to something else below.
    *pResult = CDRF_DODEFAULT;

    // First thing - check the draw stage. If it's the control's prepaint
    // stage, then tell Windows we want messages for every item.

    if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
        {
        *pResult = CDRF_NOTIFYITEMDRAW;
        }
    else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
        {
        // This is the prepaint stage for an item. Here's where we set the
        // item's text color. Our return value will tell Windows to draw the
        // item itself, but it will use the new color we set here.
        // We'll cycle the colors through red, green, and light blue.

        COLORREF crText;

        if ( (pLVCD->nmcd.dwItemSpec % 3) == 0 )
            crText = RGB(255,0,0);
        else if ( (pLVCD->nmcd.dwItemSpec % 3) == 1 )
            crText = RGB(0,255,0);
        else
            crText = RGB(128,128,255);

        // Store the color back in the NMLVCUSTOMDRAW struct.
        pLVCD->clrText = crText;

        // Tell Windows to paint the control itself.

        // pLVCD->iSubItem is column value made by zero-based
        *pResult = CDRF_DODEFAULT;
        }
}