I have some nasty resizing issue with my toolbar-windows of my engine's editor.
Each toolbar-window is a child of the main dialog, and they are aligned around the main viewport.
That gives me 4 windows which all render their own scene.
One for the top, one for the left, one for the bottom and one for the right.
The layout works well, and resizing them all does, too, but one thing isn't working as it should: Rendering after the resize.
Here is a picture of how it looks after I dragged the bottom-right corner of the window a bit:
Those white borders are pretty ugly and pretty annoying. How do I get rid of them?
Here is how it should look like (After some playing around with the debugger to force a redraw):
Just for sure, I do call the render-function in WM_PAINT, and also test-wise in WM_SIZE (Doesn't help, though).
Here is the first part of the DlgProc:
switch(msg) { case WM_SIZE: // Resize our main windows controls RECT r; GetClientRect(hWnd, &r); // Main Viewport SetWindowPos(GetDlgItem(hWnd, IDC_Viewport), HWND_TOP, EE_WNDB_MainVP_LEFT, EE_WNDB_MainVP_TOP, (r.right - EE_WNDB_MainVP_RIGHT) - (EE_WNDB_MainVP_LEFT), (r.bottom - EE_WNDB_MainVP_BOTTOM) - EE_WNDB_MainVP_TOP, 0); // Right browser window SetWindowPos(GetDlgItem(hWnd, IDC_wbrowser), HWND_TOP, r.right - EE_WNDB_MainVP_RIGHT, 0, EE_WNDB_MainVP_RIGHT, r.bottom, 0); // left toolbar window SetWindowPos(GetDlgItem(hWnd, IDC_SideBar1), HWND_TOP, 0, EE_WNDB_MainVP_TOP, EE_WNDB_MainVP_LEFT, r.bottom-EE_WNDB_MainVP_TOP-EE_WNDB_MainVP_BOTTOM, 0); // upper toolbar window SetWindowPos(GetDlgItem(hWnd, IDC_MainToolbar), HWND_TOP, 0, 0, r.right - EE_WNDB_MainVP_RIGHT, EE_WNDB_MainVP_TOP, 0); // sub toolbar window SetWindowPos(GetDlgItem(hWnd, IDC_SubToolbar), HWND_TOP, 0, r.bottom - EE_WNDB_MainVP_BOTTOM, r.right - EE_WNDB_MainVP_RIGHT, EE_WNDB_MainVP_BOTTOM, 0); //Set the viewport area to the toolbars and the browser GetWindowRect(GetDlgItem(hWnd, IDC_Viewport), &r); Engine->GetLeftToolbar()->SetMainViewportArea(&r); Engine->GetMainToolbar()->SetMainViewportArea(&r); Engine->GetBottomToolbar()->SetMainViewportArea(&r); Engine->GetWBrowser()->SetMainViewportArea(&r); //Resize swapchain Engine->GetToSwapchainRenderer()->ResizeBuffers(0, 0); break; } //Pass the messages to the registered SF_Dialog windows Engine->GetMainEditorWindowSFContainer()->OnWindowMessage(hWnd,msg,wParam,lParam);
And this is the call inside the last line of the upper code:
case WM_PAINT: GetD2DObjects()->bNeedsRedraw=true; RenderScene(true); break; case WM_SIZE: RECT s; GetClientRect(WindowHW,&s); GetD2DObjects()->WindowSize.left=s.left; GetD2DObjects()->WindowSize.top=s.top; GetD2DObjects()->WindowSize.right=s.right; GetD2DObjects()->WindowSize.bottom=s.bottom; GetD2DObjects()->RenderTarget->Resize(SizeU(s.right,s.bottom)); GetBaseObject()->SetSize(&D3DXVECTOR2(s.right,s.bottom)); RenderScene(true); break;