Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to "Tile" an array of window elements
#1
Hello,

I have been trying to find a way to "tile" an array of windows based on the screen resolution and just can't figure it out.  

Thus far I have put the following together. The example below uses notepad.exe, but my use case is a different application.  
 
Code:
Copy      Help
 
using System.Windows;
using System.Collections.Generic;

var r = screen.primary.Rect;


//print.it(r.Width);
//print.it(r.Height);



var windows = wnd.findAll(cn: "Notepad", of: "notepad.exe");

var count = windows.Length;
//print.it(count);



int width = r.Width/count;
print.it(width);

int height = r.Height/count;
print.it(height);
int x = 0;
int y = 10;



for (int i = 0; i < count; i++) {
print.it(windows[i]);
windows[i].Resize(width,height);
windows[i].MoveInScreen(x,y);
x = x + ???;
y = y + ???;
}
If anyone has so input on this I would be very thankful Smile
#2
Do you want them to tile vertically?    If you try to tile in the classic Windows 3.1 way where you end up with a grid, you might need to set constraints on the number of rows and/or columns.  It's not quite a simple thing, but can be accomplished through some math.  I can work with you on it and we can reply to the thread with one solution we came up with.


Forum Jump:


Users browsing this thread: 1 Guest(s)