diff --git a/.vs/AIProofread/v17/.suo b/.vs/AIProofread/v17/.suo index c3cb987..6958596 100644 Binary files a/.vs/AIProofread/v17/.suo and b/.vs/AIProofread/v17/.suo differ diff --git a/AIProofread/Controls/BaseWinForm.cs b/AIProofread/Controls/BaseWinForm.cs index c2da513..3575a51 100644 --- a/AIProofread/Controls/BaseWinForm.cs +++ b/AIProofread/Controls/BaseWinForm.cs @@ -112,6 +112,12 @@ namespace AIProofread.Controls this.FormBorderStyle = FormBorderStyle.None; } + public void SetHeight(int height) + { + this.Height = height; + CenterToScreen(); + } + protected async void InitWebView(WebView2 webView,String url,string name,Action callaback = null) { //Bridge.InitWebEnvAsync(name, webView); diff --git a/AIProofread/Controls/FormLogin.cs b/AIProofread/Controls/FormLogin.cs index 2d003bd..9f8efc0 100644 --- a/AIProofread/Controls/FormLogin.cs +++ b/AIProofread/Controls/FormLogin.cs @@ -14,6 +14,19 @@ namespace AIProofread.Controls public FormLogin() { InitializeComponent(); + this.FormClosed += (s, e) => + { + // 关闭时释放资源 + try + { + if (web != null) + { + web.Dispose(); + web = null; + } + } + catch { }; + }; //Bridge.InitWebEnvAsync("login", web); //Bridge.AddEventHandler(BridgeEvent.LoginSuccess, OnLoginSuccess); } @@ -21,6 +34,19 @@ namespace AIProofread.Controls { this.action = action; InitializeComponent(); + this.FormClosed += (s, e) => + { + // 关闭时释放资源 + try + { + if (web != null) + { + web.Dispose(); + web = null; + } + } + catch { }; + }; } private void OnLoginSuccess(object sender, EventArgs e) diff --git a/AIProofread/Controls/FormWebView.cs b/AIProofread/Controls/FormWebView.cs index 640a9b3..4de7414 100644 --- a/AIProofread/Controls/FormWebView.cs +++ b/AIProofread/Controls/FormWebView.cs @@ -39,6 +39,7 @@ namespace AIProofread.Controls { this.Width = (int)(width * dpiScaleFactor); this.Height = (int)(height * dpiScaleFactor); + CenterToScreen(); } private void FormWebView_Load(object sender, EventArgs e)