Remember the size and position of the main window

pull/685/head
YFdyh000 5 years ago
parent 7b2bd8876d
commit ab025b39f4

@ -52,6 +52,14 @@ namespace v2rayN.Forms
v2rayHandler = new V2rayHandler();
v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;
if(!config.formMainSize.IsEmpty) {
this.Left = config.formMainSize.X;
this.Top = config.formMainSize.Y;
this.Width = config.formMainSize.Width;
this.Height = config.formMainSize.Height;
}
this.WindowState = config.windowState;
if (config.enableStatistics)
{
statistics = new StatisticsHandler(config, UpdateStatisticsHandler);
@ -87,6 +95,10 @@ namespace v2rayN.Forms
{
if (e.CloseReason == CloseReason.UserClosing)
{
if (this.WindowState != FormWindowState.Maximized)
config.formMainSize = new Rectangle(this.Left, this.Top, this.Width, this.Height);
config.windowState = this.WindowState;
e.Cancel = true;
HideForm();
return;
@ -973,7 +985,6 @@ namespace v2rayN.Forms
private void menuExit_Click(object sender, EventArgs e)
{
this.Visible = false;
this.Close();
@ -984,7 +995,7 @@ namespace v2rayN.Forms
private void ShowForm()
{
this.Show();
this.WindowState = FormWindowState.Normal;
//this.WindowState = config.windowState;
this.Activate();
//this.notifyIcon1.Visible = false;
this.ShowInTaskbar = true;

@ -36,6 +36,17 @@ namespace v2rayN.Mode
get; set;
}
/// <summary>
/// 主窗口的大小和位置
/// </summary>
public System.Drawing.Rectangle formMainSize
{
get; set;
}
public System.Windows.Forms.FormWindowState windowState
{
get; set;
}
/// <summary>
/// 活动配置序号
/// </summary>

Loading…
Cancel
Save