> 1 | 2
> ----
> 3 | 4
>
> how do I resize the frame to exactly fit the 4 panes?
> I am opening equal
> sized images in the 4 different splitter-panes
> (Statically created) and
> would like to resize the Child Frame so that it
> tightly fits in itself the 4
> panes and the splitter-bars.
>
> I would like to add that I am talking about an MDI
> interface.
> Also, I would like to include the width of the
> splitter-bars in calculating
> the new width/height of the Child Frame in addition to
> the image sizes..
> just to make it a perfect fit.

Since there are four separate panes (views) here, you should be able to
calculate the current size of each compared to what it needs to be for the
image, and resize the child frame to absorb the excess.

Thus, GetClientRect() is the one to use for each pane. HOWEVER... I believe
CView-derived windows include the client edge in GetClientRect(), and thus
you should subtract (2 * ::GetSystemMetrics(SM_CXEDGE) ) from your width and
(2 * ::GetSystemMetrics(SM_CYEDGE) ) from your height.

Thus, assuming a method called GetInnerPaneSize() calculated these
correctly:

m_pChildFrame->GetWindowRect(&rctFrame);
        // The full frame size, in screen co-ords

rctPaneTopLeft = GetInnerPaneWidth(m_pPaneTopLeft);
... repeat for other panes ...

sizExcessPaneTopLeft.cx = rctPaneTopLeft.Width() - image_width ;
sizExcessPaneTopLeft.cy = rctPaneTopLeft.Height() - image_height ;
... repeat for other panes ...

rctFrame.right -= (sizExcessPaneTopLeft.cx + sizExcessPaneTopRight.cx);
        // Or you could have used both bottom panes.
rctFrame.bottom -= (sizExcessPaneTopLeft.cy + sizExcessPaneBottomLeft.cy);
        // Or you could have used both right-hand panes.

m_pMDIOuterFrame->ScreenToClient(&rctFrame);
        // Now in client co-ords relative to the containing MDI frame.
m_pChildFrame->MoveWindow(&rctFrame);
        // Resize. Now, panes should have shrunk to the right size.

Don't worry about the splitter bars when using the above; they're already
accounted for because we calculate how much the panes are too big (or small)
and adjust the frame's size by that much (relative), rather than trying an
absolute calculation.

--
Jason Teagle
[EMAIL PROTECTED]



_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to