1. limit the windows' minimized size
2. store window's size & position in config file. 3. fix: scroll bar sometimes disappear while sizing the window.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Shadowsocks.Model
|
||||
{
|
||||
@@ -13,6 +14,10 @@ namespace Shadowsocks.Model
|
||||
public bool topMost;
|
||||
public bool wrapText;
|
||||
public bool toolbarShown;
|
||||
public int width;
|
||||
public int height;
|
||||
public int top;
|
||||
public int left;
|
||||
|
||||
public LogViewerConfig()
|
||||
{
|
||||
@@ -23,6 +28,10 @@ namespace Shadowsocks.Model
|
||||
this.topMost = false;
|
||||
this.wrapText = false;
|
||||
this.toolbarShown = false;
|
||||
this.width = 600;
|
||||
this.height = 400;
|
||||
this.top = (Screen.PrimaryScreen.WorkingArea.Height - height) / 2;
|
||||
this.left = (Screen.PrimaryScreen.WorkingArea.Width - width) / 2;
|
||||
}
|
||||
|
||||
public Color GetBackgroundColor()
|
||||
|
||||
+5
-4
@@ -63,7 +63,7 @@
|
||||
this.LogMessageTextBox.Name = "LogMessageTextBox";
|
||||
this.LogMessageTextBox.ReadOnly = true;
|
||||
this.LogMessageTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.LogMessageTextBox.Size = new System.Drawing.Size(584, 377);
|
||||
this.LogMessageTextBox.Size = new System.Drawing.Size(378, 99);
|
||||
this.LogMessageTextBox.TabIndex = 0;
|
||||
//
|
||||
// MainMenu
|
||||
@@ -199,7 +199,7 @@
|
||||
this.tableLayoutPanel1.RowCount = 2;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(590, 418);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(384, 140);
|
||||
this.tableLayoutPanel1.TabIndex = 2;
|
||||
//
|
||||
// ToolbarFlowLayoutPanel
|
||||
@@ -212,16 +212,17 @@
|
||||
this.ToolbarFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ToolbarFlowLayoutPanel.Location = new System.Drawing.Point(3, 3);
|
||||
this.ToolbarFlowLayoutPanel.Name = "ToolbarFlowLayoutPanel";
|
||||
this.ToolbarFlowLayoutPanel.Size = new System.Drawing.Size(584, 29);
|
||||
this.ToolbarFlowLayoutPanel.Size = new System.Drawing.Size(378, 29);
|
||||
this.ToolbarFlowLayoutPanel.TabIndex = 2;
|
||||
//
|
||||
// LogForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(590, 418);
|
||||
this.ClientSize = new System.Drawing.Size(384, 140);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Menu = this.MainMenu;
|
||||
this.MinimumSize = new System.Drawing.Size(400, 200);
|
||||
this.Name = "LogForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Log Viewer";
|
||||
|
||||
@@ -120,6 +120,11 @@ namespace Shadowsocks.View
|
||||
timer.Tick += Timer_Tick;
|
||||
timer.Start();
|
||||
|
||||
this.Top = config.logViewer.top;
|
||||
this.Left = config.logViewer.left;
|
||||
this.Height = config.logViewer.height;
|
||||
this.Width = config.logViewer.width;
|
||||
|
||||
topMostTriggerLock = true;
|
||||
this.TopMost = TopMostMenuItem.Checked = TopMostCheckBox.Checked = topMostTrigger;
|
||||
topMostTriggerLock = false;
|
||||
@@ -141,6 +146,10 @@ namespace Shadowsocks.View
|
||||
config.logViewer.fontSize = LogMessageTextBox.Font.Size;
|
||||
config.logViewer.SetBackgroundColor(LogMessageTextBox.BackColor);
|
||||
config.logViewer.SetTextColor(LogMessageTextBox.ForeColor);
|
||||
config.logViewer.top = this.Top;
|
||||
config.logViewer.left = this.Left;
|
||||
config.logViewer.height = this.Height;
|
||||
config.logViewer.width = this.Width;
|
||||
Model.Configuration.Save(config);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user