[vtk-developers] SampleMFC, VTK 5.10.1, PrintPreview does not work

Doug Rumbaugh drumbaughsr at embarqmail.com
Fri Jan 25 13:09:21 EST 2013


I found the problem in that SetupMemoryRendering can not accept
pDC->m_hAttribDC during PrintPreview so you have to keep track of when it is
in PrintPreview as below:

if (!bPrintPreview)
   this->RenderWindow->SetupMemoryRendering(rcDest.right, rcDest.top,
pDC->m_hAttribDC);
else
   this->RenderWindow->SetupMemoryRendering(rcDest.right, rcDest.top,
pDC->GetSafeHdc());

You have to add a variable bPrintPreview to the view and override
OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo) and set bPrintPreview

bPrintPreview = pInfo->m_bPreview

There is another issue in that the window class vtkOpenGL never gets
registered but it seems to work.  In the MFC example,
vtkWin32OpenGLRenderWindow.WindowId is set prior to initializing the
vtkWin32OpenGLRenderWindow which causes the window class not to be
registered in CreateAWindow.  The class is needed in subsequent
initialization functions so mods to CreateAWindow are necessary.  Although
it appears to work without these mods.



--
View this message in context: http://vtk.1045678.n5.nabble.com/SampleMFC-VTK-5-10-1-PrintPreview-does-not-work-tp5718075p5718106.html
Sent from the VTK - Dev mailing list archive at Nabble.com.



More information about the vtk-developers mailing list