开发者

Get size of window in maximized version in winforms

开发者 https://www.devze.com 2023-01-21 16:50 出处:网络
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

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 ch开发者_运维知识库ange 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);


You can read the workingarea-screen size.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消