[vtk-developers] Re: GUISupport directory ?
de Boer Ingo
I.deBoer at polytec.de
Mon Feb 14 11:26:22 EST 2005
> The source is in the current CVS (VTK/GUISupport/MFC).
Thanks... I just took a look at it...
I have a question. You wrote this:
// setup the parent window
this->renWin->SetWindowId(this->GetSafeHwnd());
this->iren->SetRenderWindow(this->renWin);
this->iren->Initialize();
I did in my samples something like:
// setup the parent window
this->renWin->SetWindowId(this->GetSafeHwnd());
this->renWin->SetParentId(this->GetParent()->GetSafeHwnd());
this->iren->SetRenderWindow(this->renWin);
this->iren->Initialize();
and set the parent ID. Isn't it necessary to set the parent ID ?
Did you try my samples ?
In my opinion, three samples would be needed, MDI,SDI and
dialog-based. This is what people do. The only trouble
with the dialog-based application I had, was, that I
could not do a double click. For the MDI and SDI it worked
fine.
In WindowProc you set the focus for the button down.
Is this necessary ? If yes, shouldn't you set the focus
also for WM_MOUSEWHEEL and WM_KEYDOWN ?
In the OnSize function, wouldn't a call like
this->iren->UpdateSize(cx, cy);
be enough ?
How about extending the OnPaint with printing ?
Like this (pseudo, taken from my code)
if ( pDC->IsPrinting() )
{
// Obtain the size of the printer page in pixels.
int cxPage = pDC->GetDeviceCaps(HORZRES);
int cyPage = pDC->GetDeviceCaps(VERTRES);
// Get the size of the window in pixels.
int *size = this->pvtkWin32OpenGLRW->GetSize();
int cxWindow = size[0];
int cyWindow = size[1];
float fx = float(cxPage) / float(cxWindow);
float fy = float(cyPage) / float(cyWindow);
float scale = min(fx,fy);
int x = int(scale * float(cxWindow));
int y = int(scale * float(cyWindow));
this->pvtkWin32OpenGLRW->SetupMemoryRendering(cxWindow, cyWindow, pDC->GetSafeHdc());
this->pvtkWin32OpenGLRW->Render();
HDC memDC = this->pvtkWin32OpenGLRW->GetMemoryDC();
StretchBlt(pDC->GetSafeHdc(),0,0,x,y,memDC,0,0,cxWindow,cyWindow,SRCCOPY);
this->pvtkWin32OpenGLRW->ResumeScreenRendering();
}
else
{
// TODO: add draw code for native data here
if (this->pvtkWin32RenderWI->GetInitialized())
{
this->pvtkWin32OpenGLRW->Render();
}
}
greets
Ingo
More information about the vtk-developers
mailing list