Jla
Jla

Reputation: 11374

Get size of window in maximized version in winforms

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);

Upvotes: 4

Views: 8212

Answers (2)

Aykut Çevik
Aykut Çevik

Reputation: 2088

You can read the workingarea-screen size.

Upvotes: 6

Peter van Kekem
Peter van Kekem

Reputation: 1447

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

Upvotes: 0

Related Questions