excel:预览的情况下,点击打印。预览框关
word:预览的情况下,点击打印。预览框不会关掉现在只实现了象excel的功能。而要求是word那样功能
//初期处理 
virtual void OnInitialUpdate();
//预览终了处理
virtual void OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView);
//预览处理
virtual void OnFilePrintPreview();
// 预览/打印前处理
virtual BOOL OnPreparePrinting( CPrintInfo* pInfo );
//打印前处理
virtual void OnBeginPrinting( CDC* pDC, CPrintInfo* pInfo );
//打印后处理
virtual void OnEndPrinting( CDC* pDC, CPrintInfo* pInfo );准备在OnEndPrintPreview方法的时候,也就是在结束preview的时候,ToolBar放上去,但是怎么也不能把“打印”“放大”“缩小”等保存不下来
ToolBar是自动删除的?谁知道的,帮帮忙,非常感谢!

解决方案 »

  1.   

    准备在OnEndPrintPreview方法的时候,也就是在结束preview的时候,ToolBar放上去,但是怎么也不能把“打印”“放大”“缩小”等保存不下来
    ToolBar是自动删除的? ========================
    什么意思?
      

  2.   

    你关注什么TOOLBAR干什么? 
    在OnEndPrintPreview中有
    if (pView->m_pPrintView != NULL)
    pView->m_pPrintView->OnEndPrinting(pDC, pInfo); CFrameWnd* pParent = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd());
    ASSERT_VALID(pParent); // restore the old main window pParent->OnSetPreviewMode(FALSE, pView->m_pPreviewState); // Force active view back to old one
    pParent->SetActiveView(pView->m_pPreviewState->pViewActiveOld);
    if (pParent != GetParentFrame())
    OnActivateView(TRUE, this, this);   // re-activate view in real frame
    pView->DestroyWindow();     // destroy preview view
    // C++ object will be deleted in PostNcDestroy // restore main frame layout and idle message
    pParent->RecalcLayout();
    pParent->SendMessage(WM_SETMESSAGESTRING, (WPARAM)AFX_IDS_IDLEMESSAGE, 0L);
    pParent->UpdateWindow();
    if (pView->m_pPrintView != NULL)
    pView->m_pPrintView->OnEndPrinting(pDC, pInfo); CFrameWnd* pParent = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd());
    ASSERT_VALID(pParent); // restore the old main window
    pParent->OnSetPreviewMode(FALSE, pView->m_pPreviewState); // Force active view back to old one
    pParent->SetActiveView(pView->m_pPreviewState->pViewActiveOld);
    if (pParent != GetParentFrame())
    OnActivateView(TRUE, this, this);   // re-activate view in real frame
    pView->DestroyWindow();     // destroy preview view
    // C++ object will be deleted in PostNcDestroy // restore main frame layout and idle message
    pParent->RecalcLayout();
    pParent->SendMessage(WM_SETMESSAGESTRING, (WPARAM)AFX_IDS_IDLEMESSAGE, 0L);
    pParent->UpdateWindow();
    这个函数会把焦点还给父窗口,销毁打印预览窗口;我想你应该根据自己的需要对这个函数进行重写,实现你自己的功能。