MFC PrintPreview and CReBars

MFC PrintPreview and CReBars

Post by Agris Klimkan » Fri, 21 Jan 2000 04:00:00


I'd really appreciate any hints on the following VC++6.0/MFC matter:

I am using a CReBar object in the class 'CMainFrame :: public CMDIFrameWnd' to show/hide bands (toolbars,dialogbars) according to the active document type. Problem is that after the PrintPreview command the CMainFrame shows ALL rebar bands despite the fact that only a few of them were visible before the PrintPreview. I tried to use the following code to get around, but without any success:

void CCurrents2DView::OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView)
 CChild2DFrame* pCfrm = (CChild2DFrame*) GetParentFrame();
 CMainFrame* pFrame = (CMainFrame*)pCfrm->GetMDIFrame();

 CScrollView::OnEndPrintPreview(pDC, pInfo, point, pView);



How to show only those bands which were visible before the PrintPreview?
Thanks in advance!
Agris Klimkans
Dept. of Physical Chemistry, office 5020
Chalmers University of Technology
S-41296 Gothenburg

 phone: (+46)31-7723051
   fax: (+46)31-7723858



1. PrintPreview - Problem inTrying to copy Printpreview' DC's image

PrintPreview's painting and scrolling is so slow. Instead of drawing it's
everytime on  OnDraw; I decided to draw on the real DC once,  copy  it's
to a compatible DC and later, when OnDraw is called again for that page, I
copy the bitmap from compatible Dc to PrintPreview's DC's Bitmap.
Unfortunately two problems happens:
 1) The bitmap looks some distortioned
 2) Bitmap's bottom part (which is invisible at the beginning), can't be
copied. When
I scroll the view, this part looks totaly black.

When I copy , I change the origination and Mapping mode. I change mapping
mode from Anisotrophic to  text.

Best Regards:

Here is how OnDraw  looks
OnDraw(CDC *pDC, CPrintInfo *pInfo)
        if (this is the same of the previous page )
        // compy compatible Dc's image to the current dc
            pDC->SetViewportOrg(0, 0);
           pDC->SetWindowOrg(0, 0);
           nPrevMapMode = pDC->SetMapMode(MM_TEXT);  
        pDC->BitBlt(0, 0,,, m_pTempDC, 0, 0,SRCCOPY);                
 // draw to this page for the first time
 // ....
// Save the Dc's bitmap into a compatible bitmap
if (m_pTempDC->CreateCompatibleDC(pDC))
   = pDC->GetDeviceCaps(HORZRES);
   = pDC->GetDeviceCaps(VERTRES);
            if (m_pTempBitmap->CreateCompatibleBitmap(pDC,,
                    pView->OnPrepareDC(m_pTempDC, pInfo);
                    pDC->SetViewportOrg(0, 0);
                    pDC->SetWindowOrg(0, 0);
                    m_pTempDC->SetViewportOrg(0, 0);
                    m_pTempDC->SetWindowOrg(0, 0);
                    m_pOldBitmap = m_pTempDC->SelectObject(m_pTempBitmap);
                    BOOL bResult = pDC->GetDeviceCaps(RASTERCAPS) &
                    m_pTempDC->BitBlt(0, 0,,, pDC, 0, 0,


2. nmbd/nmbd_browsesync.c:domain_master_node_status_fail(264)

3. MFC: Print/PrintPreview multiple views

4. Array member in a class problem

5. CReBar and CDialog

6. SUN CD's Available--SOLARIS & SPARC64

7. CRebar / CRebarCtrl Question?

8. remove gripper from CReBar?

9. Create Windows Media Player Control on CReBar Control

10. Edge for Toolbar in CReBar

11. Lost PrintPreview CDialogBar focus in an ActiveX Control???

12. Problem of Handling PrintPreview w.Win32