.NET / Windows窗体:记住窗口的大小和位置 [英] .NET / Windows Forms: remember windows size and location

查看:313
本文介绍了.NET / Windows窗体:记住窗口的大小和位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows窗体应用程序与普通的窗口。现在,当我关闭应用程序并重新启动它,我想主窗口会出现在我的屏幕,当它被关闭的那一刻同样大小的相同位置。

I have a Windows Forms application with a normal window. Now when I close the application and restart it, I want that the main window appears at the same location on my screen with the same size of the moment when it was closed.

有没有在Windows窗体一种简单的方式来记住屏幕上的位置和窗口大小(如果可能的话窗口状态),还是一切都必须由手工完成?

Is there an easy way in Windows Forms to remember the screen location and window size (and if possible the window state) or does everything have to be done by hand?

推荐答案

您将需要保存在您的应用程序设置窗口的位置和大小。这里有一个很好的C#文章向您展示如何。

You'll need to save the window location and size in your application settings. Here's a good C# article to show you how.

修改

您可以保存您想要pretty的任何东西的应用程序设置。在设置网格的类型列,你可以浏览到任何.NET类型。的WindowState是System.Windows.Forms中,被列为FormWindowState。还有的FormStartPosition属性。

You can save pretty much anything you want in the application settings. In the Type column of the settings grid you can browse to any .NET type. WindowState is in System.Windows.Forms and is listed as FormWindowState. There's also a property for FormStartPosition.

这篇关于.NET / Windows窗体:记住窗口的大小和位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆