Window Positioning

  • Thread starter Thread starter web1110
  • Start date Start date
W

web1110

I have an opening form that I want to size to 90% screen width and 90%
screen width, I want to set the location of the top left corner to 5%
values.

Ths size comes out correctly, but on each successive open, the window move
down and left. The positioning/sizing code is shown below.

Any ideas on how to prevent the down and left creep?

Rectangle stScreenDims=Screen.GetBounds(Bounds);
stScreenDims.Location=new Point(stScreenDims.Width/20,
stScreenDims.Height/20);
stScreenDims.Height=stScreenDims.Height*9/10;
stScreenDims.Width=stScreenDims.Width*9/10;

this.Location=stScreenDims.Location;
this.Width=stScreenDims.Width;
this.Height=stScreenDims.Height;
 
Back
Top