Microsoft KB Archive/72135

-

{|
 * width="100%"|

The information in this article applies to:
 * Microsoft Windows Software Development Kit (SDK) for Windows versions 3.0, 3.1

SUMMARY
MDITile.exe is a sample that demonstrates how to implement an alternate tiling scheme for the multiple document interface (MDI) of Windows version 3.0. The alternate tiling scheme demonstrated in this sample attempts to tile MDI child windows so they are wider than they are tall. The default MDI tiling scheme sizes the child windows to be tall and narrow. This is unsuitable for MDI applications based on text such as a word processor.

MORE INFORMATION
The following file is available for download from the Microsoft Software Library:

~ MDITile.exe (size: 29870 bytes) For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base: ARTICLE-ID: Q119591 TITLE    : How to Obtain Microsoft Support Files from Online Services The horizontally based tiling scheme implemented in this sample uses the following eight-step procedure:  Count the number of MDI child windows that are not iconic (represented by an icon). These are the only windows affected by tiling. This value is saved in &quot;cKids.&quot; Find the next square (that is, a number &quot;n,&quot; such that some integer &quot;x&quot; is the square root, x*x == n), that is greater than the number of windows to tile. Set a column value, &quot;cCols,&quot; to &quot;x-1,&quot; where &quot;x&quot; is the root of the square found in step 2. Set a row counter, &quot;cRows,&quot; to &quot;cKids / cCols.&quot; Set a remainder counter, &quot;cMulRows,&quot; to &quot;cKids % cCols.&quot; This accounts for the child windows that are not included in the base grid of cCols by cRows. Get the dimensions of the client rectangle in which tiling is to occur. Note that it may be desirable to reduce the size of this rectangle to leave space at the bottom of the MDI client window for a row of icons. Divide the vertical height of the rectangle by cRows to get the child window height, and divide the horizontal width of the rectangle by cCols to get the child window width.  Loop through each row. In this row, the application will tile cCols child windows. The value &quot;cRows-cMulRows&quot; is the number of rows that can be created with cCols columns. If the rows that can have cCols columns have already been done, then increment cCols so that all remaining rows have an extra window. Since cMulRows are left to tile, adding one window to each row account for all remaining windows. This is also why cCols was initially &quot;x-1.&quot; If &quot;cCols==x,&quot; then the first rows (at the top of the window) would have more windows than rows on the bottom. If this tiling scheme is desired, set cCols to &quot;x&quot; as the assumed number of columns, then decrement cCols when cMulRows have been tiled.  Once the number of columns has been calculated, loop through the columns, moving each window to the appropriate section of that row.</li></ol>

NOTE: It is preferable to move windows with BeginDeferWindowPos, DeferWindowPos, and EndDeferWindowPos, instead of many calls to SetWindowPos, because the visual effect of the window movement is much cleaner.
 * }

-

Last reviewed: September 10, 1998

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.