I'm curious, why would you want to do this?
Anyway, the following code is one way to do it (note that the user can still
resize/move the form without OnPaint being fired...so you may want make this
a separate method and call it from the OnPaint, OnMove, and OnResize events.
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs
e)
{
Rectangle rect = Screen.GetWorkingArea(this);
// Only change the size if it is different.
if ( (this.Size.Width != rect.Width) || (this.Size.Height !=
rect.Height) )
{
this.Size = new Size(rect.Width, rect.Height);
}
// I have to assume you want the form to be at position 0,0...this part
will do that.
// Only change the location if it is different.
if ( (this.Location.X != 0) || (this.Location.Y != 0) )
{
this.Location = new Point(0, 0);
}
}
ShaneB