// Fill the tree special text.
hItem = m_wndTree.InsertItem("Parent Item default A", 0, 0);
hChild = m_wndTree.InsertItem("Child Item default A", 1, 1, hItem);
hItem = m_wndTree.InsertItem("Parent Item default B", 0, 0);
hChild = m_wndTree.InsertItem("Child Item default B", 1, 1, hItem);
// Fill the tree with Text and Icons
hItem = m_wndTree.InsertItem( "Floppy Drive", ILI_FLOPPY, ILI_FLOPPY );
hChild = m_wndTree.InsertItem( "Child Node", ILI_CLOSED_FOLDER,
ILI_OPEN_FOLDER, hItem, TVI_SORT);
添加函数
void CCTestView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
// Define the Originmapping of the viewport and
// the window for Footer and Header
int iSavedPageStart = pInfo->m_rectDraw.top;
pDC->SetWindowOrg( 0, 0 );
pDC->SetViewportOrg( pInfo->m_rectDraw.left, -iSavedPageStart );
// Print the Page
// Get the View-DC
CDC* pViewDC = GetDC();
// Set the Mappingmode
pDC->SetMapMode(MM_ANISOTROPIC);
// Define the Originmapping of the viewport and
// the window for Treeoutput
pDC->SetWindowOrg( 0, 0 );
pDC->SetViewportOrg( pInfo->m_rectDraw.left, pInfo->m_rectDraw.top - iSavedPageStart );
// Define the Extentmapping of the viewport and the Window
pDC->SetViewportExt( pDC->GetDeviceCaps(LOGPIXELSX)
,pDC->GetDeviceCaps(LOGPIXELSY) );