tiling windows

  • Thread starter Thread starter Piotrek Stachowicz
  • Start date Start date
P

Piotrek Stachowicz

Hello,
I write application which displays 3 windows at the startup. Is there
any way (apart from hardcoding their location), to display them tiled (so
that they do not overlap)?

Thx

Piotrek Stachowicz
 
You can do it by .NET tools only in MDI container.
If you have separate forms opened within regular enviroment you will need to
calculate their locations.
From the other habd you can prebuild screen bounds and set each one of you
windows StartPosition to WindowsDefaultBounds. Hope it'll help.
 
Hi,

you could get the screen size and then calculate the position from that
point.

Snippet:

For Window #1:

Rectangle workrect = Screen.PrimaryScreen.WorkingArea;
this->Height = workrect.Height /3;


For Window #2:

Rectangle workrect = Screen.PrimaryScreen.WorkingArea;
this.Height = workrect.Height /3;
Point ptTopLeft = new Point(0,this.Height);
this.Location = ptTopLeft;


For Window #3:

Rectangle workrect = Screen.PrimaryScreen.WorkingArea;
this.Height = workrect.Height /3;
Point ptTopLeft = new Point(0,2*this.Height);
this.Location = ptTopLeft;

This should solve your problem. I'm not sure whether all the calls are
correct, since I'm coding C++ at the moment, so I might get confused,
but this is basically the way to go.

Martin
 
Back
Top