tags:

views:

11

answers:

2

How can I get the size a form would have in Maximized windowstate without maximizing it ?

I am doing a snapshot of a map control. I want to maximize the window when doing the snapshot but without the user noticing. It seems that the form windows state doesn't change the form size when it is hidden :

this.Hide();
this.WindowState = FormWindowState.Maximized;
// Snapshot but this.Size didn't change
this.WindowState = FormWindowState.Normal;
this.Show();

It works fine when not hiding.

So I'm trying to set the size manually but need to know the Maximized state width and height:

// x & y ???    
this.Size = new Size(x,y);
A: 

Try the SuspendLayout() function to suspend layout updates to your screen. By calling ResumeLayout() you can resume this.

Peter van Kekem
+1  A: 

You can read the workingarea-screen size.

cevik
Just what I was looking for. Thanks.
DrDro