public static void ArrangeIntoRowsAndColumns(FrmMain p) { int columns = (int)Math.Ceiling(p.clients.Count / 2.0f); int rows = (int)Math.Floor(p.clients.Count / 2.0f); if (rows > 2) { rows -= 1; //not sure why this works but it does! } int X = 0; int Y = 0; foreach (Client c in p.clients) { if (X > columns - 1) { X = 0; Y++; } Native.SetWindowSize(c.clientProcess, new Size(p.splitMain.Width / columns, p.splitMain.Height / rows), p.Location.X); Native.SetWindowLocation(c.clientProcess, new Point(X * (p.splitMain.Width / columns), Y * (p.splitMain.Height / rows))); X += 1; } }
public static void ArrangeIntoColumns(FrmMain p) { int X = 0; foreach (Client c in p.clients) { Native.SetWindowSize(c.clientProcess, new Size(p.splitMain.Width / p.clients.Count, p.splitMain.Height), p.Location.X); Native.SetWindowLocation(c.clientProcess, new Point(X, 0)); X += p.splitMain.Width / p.clients.Count; } }
public static void ResetLayout(FrmMain p) { if (clientMode == 0) //fixed { p.splitMain.SplitterDistance = p.ClientRectangle.Height / 2 - 39; //-39 due to header p.splitTop.SplitterDistance = p.ClientRectangle.Width / 2; p.splitBottom.SplitterDistance = p.ClientRectangle.Width / 2; } else //freeform { Point loc = new Point(0, 0); foreach (Client c in p.clients) { p.BringToFront(); Native.SetWindowLocation(c.clientProcess, loc); Native.SetWindowSize(c.clientProcess, new Size(800, 600), p.Location.X); loc.X += 25; loc.Y += 30; } } }
public static void Start(FrmMain p, int numClients, string clientPath, int mode) { clientMode = mode; if (mode == 0) //fixed { for (int i = 0; i < numClients; i++) { p.clients.Add(new Client(p.panels[i], clientPath, false, i)); } } else //freeform { for (int i = 0; i < numClients; i++) { p.clients.Add(new Client(p.splitMain, clientPath, true, i)); } try { int index = 0; foreach (string data in Config.Default.freeformLayoutData.Split('|')) { if (p.clients.Count >= index + 1 && data.Length > 0) { Point location = new Point( int.Parse(data.Split(',')[0]), int.Parse(data.Split(',')[1])); Size size = new Size( int.Parse(data.Split(',')[2]), int.Parse(data.Split(',')[3])); Native.SetWindowLocation(p.clients[index].clientProcess, location); Native.SetWindowSize(p.clients[index].clientProcess, size, p.Location.X); } index++; } } catch { } } }
public static void ArrangeIntoMainClientSetup(FrmMain p) { int columns = (int)Math.Ceiling((p.clients.Count - 1) / 2.0f); int rows = (int)Math.Floor((p.clients.Count - 1) / 2.0f); if (rows > 3) { rows -= 1; //not sure why this works but it does! } int X = 0; int Y = 0; foreach (Client c in p.clients) { if (c == p.clients[0]) //main { Native.SetWindowSize(c.clientProcess, new Size(p.splitMain.Width / 2, p.splitMain.Height), 0); Native.SetWindowLocation(c.clientProcess, new Point(0, 0)); } else //others { if (X > columns - 1) { X = 0; Y++; } Native.SetWindowSize(c.clientProcess, new Size(p.splitMain.Width / 2 / columns, p.splitMain.Height / rows), p.Location.X); Native.SetWindowLocation(c.clientProcess, new Point(X * (p.splitMain.Width / 2 / columns) + (p.splitMain.Width / 2), Y * (p.splitMain.Height / rows))); X += 1; } } }