MFC PrintPreview and CReBars

MFC PrintPreview and CReBars

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



Hello!

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();
 ASSERT(pCfrm->IsKindOf(RUNTIME_CLASS(CChild2DFrame)));
 CMainFrame* pFrame = (CMainFrame*)pCfrm->GetMDIFrame();
 ASSERT(pFrame->IsKindOf(RUNTIME_CLASS(CMainFrame)));

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

 pFrame->m_wndReBar.GetReBarCtrl().ShowBand(0,TRUE);
 pFrame->m_wndReBar.GetReBarCtrl().ShowBand(1,TRUE);
 pFrame->m_wndReBar.GetReBarCtrl().ShowBand(2,FALSE);
 pFrame->m_wndReBar.GetReBarCtrl().ShowBand(3,FALSE);
 pFrame->m_wndReBar.GetReBarCtrl().ShowBand(4,FALSE);

Quote:}

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
Sweden

 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
contents
everytime on  OnDraw; I decided to draw on the real DC once,  copy  it's
bitmap
to a compatible DC and later, when OnDraw is called again for that page, I
only
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.
         omer

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, size.cx, size.cy, m_pTempDC, 0, 0,SRCCOPY);                
        return;
        }
 // draw to this page for the first time
 // ....
// Save the Dc's bitmap into a compatible bitmap
if (m_pTempDC->CreateCompatibleDC(pDC))
        {
            size.cx = pDC->GetDeviceCaps(HORZRES);
            size.cy = pDC->GetDeviceCaps(VERTRES);
            if (m_pTempBitmap->CreateCompatibleBitmap(pDC, size.cx,
size.cy))
            {
                    pView->OnPrepareDC(m_pTempDC, pInfo);
                    pDC->SetViewportOrg(0, 0);
                    pDC->SetWindowOrg(0, 0);
                   pDC->SetMapMode(MM_TEXT);
                    m_pTempDC->SetViewportOrg(0, 0);
                    m_pTempDC->SetWindowOrg(0, 0);
                    m_pTempDC->SetMapMode(MM_TEXT);
                    m_pOldBitmap = m_pTempDC->SelectObject(m_pTempBitmap);
                    BOOL bResult = pDC->GetDeviceCaps(RASTERCAPS) &
RC_BITBLT;
                    m_pTempDC->BitBlt(0, 0, size.cx, size.cy, pDC, 0, 0,
SRCCOPY);

            }
    }

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