fix: ServerForm High DPI Scale #388

This commit is contained in:
ChsBuffer
2020-10-07 20:37:07 +08:00
parent d213872bde
commit 7e907eef6f
2 changed files with 29 additions and 17 deletions

View File

@@ -124,11 +124,6 @@
this.Name = "ServerForm";
this.Padding = new System.Windows.Forms.Padding(11, 5, 11, 4);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Load += new System.EventHandler(this.ServerForm_Load);
this.ConfigurationGroupBox.ResumeLayout(false);
this.ConfigurationGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion

View File

@@ -32,6 +32,35 @@ namespace Netch.Forms
_saveActions.Add(PortTextBox, s => Server.Port = ushort.Parse((string) s));
}
public new void ShowDialog()
{
AfterFactor();
base.ShowDialog();
}
public new void Show()
{
AfterFactor();
base.Show();
}
private void AfterFactor()
{
Text = TypeName ?? string.Empty;
RemarkTextBox.Text = Server.Remark;
AddressTextBox.Text = Server.Hostname;
PortTextBox.Text = Server.Port.ToString();
AddSaveButton();
i18N.TranslateForm(this);
ConfigurationGroupBox.ResumeLayout(false);
ConfigurationGroupBox.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
protected void CreateTextBox(string name, string remark, Func<string, bool> check, Action<string> save, string value, int width = InputBoxWidth)
{
_controlLines++;
@@ -120,18 +149,6 @@ namespace Netch.Forms
private readonly Dictionary<Control, Action<object>> _saveActions = new Dictionary<Control, Action<object>>();
private void ServerForm_Load(object sender, EventArgs e)
{
Text = TypeName ?? string.Empty;
RemarkTextBox.Text = Server.Remark;
AddressTextBox.Text = Server.Hostname;
PortTextBox.Text = Server.Port.ToString();
AddSaveButton();
i18N.TranslateForm(this);
}
private void AddSaveButton()
{
_controlLines++;