SIL.FieldWorks.Common.Framework.FwApp.CalcTileSizeAndSpacing C# (CSharp) Méthode

CalcTileSizeAndSpacing() private méthode

This method can be used to do the size and spacing calculations when tiling either side-by-side or stacked. It calculates two things: 1) The desired width or height of tiled windows. 2) how many pixels between the left or top edges of tiled windows. If the calculated width or height of a window is less than the allowable minimum, then tiled windows will be overlapped.
private CalcTileSizeAndSpacing ( Screen scrn, List windowsToTile, int screenDimension, int minWindowDimension, int &desiredWindowDimension, int &windowSpacing ) : void
scrn System.Windows.Forms.Screen The screen where the tiling will take place (only windows on this /// screen will actually get tiled).
windowsToTile List A list of all the windows to tile (including the /// current window)
screenDimension int The width or height, in pixels, of the display on /// which tiling will be performed.
minWindowDimension int The minimum allowable width or height, in pixels, /// of tiled windows.
desiredWindowDimension int The desired width or height, in pixels, of /// tiled windows.
windowSpacing int The distance, in pixels, between the left or top edge /// of each tiled window. If there is only one window, this is undefined.
Résultat void
		private void CalcTileSizeAndSpacing(Screen scrn, List<IFwMainWnd> windowsToTile,
			int screenDimension, int minWindowDimension,
			out int desiredWindowDimension, out int windowSpacing)
		{
			int windowCount = windowsToTile.Count;

			// Don't count windows if they're minimized.
			foreach (Form wnd in windowsToTile)
			{
				if (wnd.WindowState == FormWindowState.Minimized ||
					Screen.FromControl(wnd).WorkingArea != scrn.WorkingArea)
					windowCount--;
			}

			desiredWindowDimension = windowSpacing = screenDimension / windowCount;

			// Check if our desired window width is smaller than the minimum. If so, then
			// calculate what the overlap should be.
			if (desiredWindowDimension < minWindowDimension)
			{
				double overlap = (minWindowDimension * windowCount - screenDimension) /
					(windowCount - 1);

				windowSpacing = minWindowDimension - (int)Math.Round(overlap + 0.5);
				desiredWindowDimension = minWindowDimension;
			}
		}

Same methods

FwApp::CalcTileSizeAndSpacing ( Screen scrn, int screenDimension, int minWindowDimension, int &desiredWindowDimension, int &windowSpacing ) : void