Dear Prof-UIS.
I always receive your help. Thanks a lot.
But I can’t see any word about CExtPaintManager in your help file. Could you tell me where to get that.
In fact I would like to have g_paintmanager to paint the specified window area that is scrolled.
I got the code that enable the print preview from Cformview.
That code works well with Prof-UIS when the CFormview is small and don’t need to have any scrollbar.
But It has some trouble if the CFormview is larger than screen and some parts are scrolled.
Fortunately my application has the fixed size of formview and I decided to use the fixed size CRect in making bitmap instead of GetClientRect().
but g_paintmanager still use GetClientRect in the PaintDockerBkgnd(). So the scrolled area has black color.
How can I overcome it? I am going to send the sample code to you by email.
Thanks
void CMyFormView::OnFilePrintPreview()
{
CRect rect(0,0,851,679);
// this->GetClientRect( rect );
CDC memDC;
CClientDC dc( this );
memDC.CreateCompatibleDC( &dc );
CBitmap bitmap;
bitmap.CreateCompatibleBitmap( &dc, rect.Width(), rect.Height() );
{
LocalGDI local( &memDC, &bitmap );
this->Print( &memDC, PRF_CLIENT|PRF_CHILDREN|PRF_ERASEBKGND );
}
m_dib.Attach( GDIUtil::DDBToDIB( bitmap ) );
CExtWS< CExtAFV< CFormView > >::OnFilePrintPreview( );
}
LRESULT CMyFormView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT IResult = CExtWS< CExtAFV< CFormView > >::WindowProc(message, wParam, lParam);
if (message == WM_INITDIALOG)
OnInitialUpdate();
if( message == WM_PRINTCLIENT )
{
ASSERT_VALID( this );
CDC* pDC = CDC::FromHandle((HDC)wParam); //the specified device context
CRect rcClient(0,0,851,679);
// GetClientRect( &rcClient );
CExtMemoryDC dc( pDC, &rcClient );
bool bTransparent = false;
if( g_PaintManager->GetCb2DbTransparentMode( this ) )
{
CExtPaintManager::stat_ExcludeChildAreas(dc.GetSafeHdc(), GetSafeHwnd(),
CExtPaintManager::stat_DefExcludeChildAreaCallback);
if( g_PaintManager->PaintDockerBkgnd( true, dc, this ) )
bTransparent = true;
}// if( g_PaintManager->GetCb2DbTransparentMode( this ) )
if( ! bTransparent )
dc.FillSolidRect(&rcClient,
g_PaintManager->GetColor(CExtPaintManager::CLR_3DFACE_OUT, this));
///////////////////////////////////////////////////
//////// DRAW YOUR RECTANGLES ON dc HERE ////////
///////////////////////////////////////////////////
return 0;
} // if( message == WM_PAINT )
return IResult;
}